When using the HTTP slice module with Nginx cofigured as a caching reverse proxy, from an empty cache, the access log shows a cache HIT for almost all requests, despite Nginx fetching the file from the upstream server in the background. The cache status should be a MISS if Nginx does not have the slice(s) required to fulfil the client's request.
This is when using Nginx with DNS spoofing to cache game files on a LAN.
# request it before Nginx has finished downloading the file.
# Cache data in the cache named "installers"
When using the slice module, the first slice is fetched in the main request, while all other slices are fetched in subrequests. Since you log only the main request (by default), the variable $upstream_cache_status returns cache status of the first slice, which is likely to be cached. If you want to log subrequests as well, use "log_subrequest on" directive.
Yes, that gives the desired result, though is there a variable that can be logged that shows whether the logged request is a subrequest?
Edit: Apache has the variable "IS_SUBREQ" which is true when the request is a subrequest - does an equivalent exist in Nginx?
There's no such variable. But you can use the fact, that the main request log entry comes after all subrequests.