Prevent reverse proxy from sending range headers to source server
mdounin at mdounin.ru
Fri Feb 5 13:24:05 UTC 2016
On Thu, Feb 04, 2016 at 08:38:15PM -0500, FSC wrote:
> Hello everyone!
> I set up my reverse proxy to cache files stored at AWS S3. I want to
> minimize the amount of traffic generated at AWS.
> Many of the files are mp4s. Clients make GET requests with the range set. A
> video player may get multiple chunks of a file at once.
> How can I have the proxy server NOT send the client's Range header along to
> AWS S3? I want the cached version to be used. The file should only be
> revalidated after the set period of 30 days.
> So it seems like I would need something along proxy_set_header but something
> that unsets the header sent to the proxied server.
As already mentioned by Robert, proxy_set_header with an empty
value will prevent a header from being sent to upstream servers.
Note well that when caching is enabled, nginx will not send the
Range header to upstream servers. It is removed automatically
along with several other headers, see
: If caching is enabled, the header fields “If-Modified-Since”,
: “If-Unmodified-Since”, “If-None-Match”, “If-Match”, “Range”, and
: “If-Range” from the original request are not passed to the proxied
That is, there is no need to do anything special with the Range
More information about the nginx