we use an nginx reverse proxy cache to serve media file downloads.
An issue we currently have is that for the first uncached requests to
the proxy, nginx is unable to respond to partial-requests and returns
HTTP 200 instead which results in errors for some download clients.
Is there a workaround for this problem?
Would it be possible when disabling sendfile or using direct i/o or
forwarding uncached requests directly to the origins and caching in the
background?
On Wed, Nov 10, 2010 at 08:03:04AM -0500, niwo wrote:
Hi,
we use an nginx reverse proxy cache to serve media file downloads.
An issue we currently have is that for the first uncached requests to
the proxy, nginx is unable to respond to partial-requests and returns
HTTP 200 instead which results in errors for some download clients.
“Some download clients” probably have to be fixed, as 200 is
allowed response for range requests.
Is there a workaround for this problem?
You may pass Range requests to backends with something like
proxy_set_header Range $http_range;
proxy_set_header If-Range $http_if_range;
and don’t cache responses to these requests at all:
and don’t cache responses to these requests at all:
proxy_no_cache $http_range $http_if_range;
Should nginx honor “Range” requests for files that are in cache
locally? 0.7.67 doesn’t seem to do so in my testing. In fact, it
always seems to send 200 with the entire file, even for static files
that are hosted on the local file system.
Oops, you’re quite correct. I was testing it wrong. I goofed the
syntax of the Range header (using “Range: 0-100” instead of “Range:
bytes=0-100”). My apologies, I misunderstood that the explicit
“bytes-unit” is required by RFC 2616, even though the RFC defines
“bytes” and no other range units.