How can I make nginx ignore the If-Range
header when reading from a cache? My current configuration is:
location / { proxy_set_header If-Range ""; proxy_cache download; proxy_cache_valid 200 30m; proxy_buffering on; proxy_pass http://s3-eu-central-1.amazonaws.com; }
I have a legacy client (in hardware, so not changeable) which includes an invalid If-Range
header, in a request like
curl -k -H 'if-range: 1234' -H 'Range: bytes=195609-' https://myserver.example/...
My configuration works great if the cache is empty; the client gets an HTTP 206 response with the desired range. But when nginx fulfills the request from its own cache, it returns the entire file with HTTP 200, instead of just the desired range.
So how do I make nginx send a HTTP 206 response even if the If-Range
header does not match? Can I for example rewrite the request and strike/replace the offending request header, or configure the cache to ignore the If-Range
request header?