proxy_ignore_headers doesn't seem to work

piotr nginx-forum at
Wed Jan 4 20:12:10 UTC 2012


Sorry for the late response.

I'm trying to hide those headers, you can see it in config posted

proxy_ignore_headers X-Accel-Expires Expires Cache-Control Set-Cookie;
proxy_cache_valid 200 302 600h;
proxy_cache_valid any 90m;

But as you can see, you can find expire, cache-control headers in proxy
repsonse, and also in headers of stored cache files on disk. With values
from upstream server, not those set in config.

I'm not sure now those times from my previous response, but whatever i
do (delete cached files from disk, restart nginx, wait 10 minutes to
expire files cached on disk), nginx is always returning in response
cache-control and expire in 600 sec - taking this value from upstream
server, not from the config file. Also, file is stored on disk for 600s,
after this time i can see in logs that nginx is downloading again file
from upstream server. Nginx should cache files for 600h in current
config, but i've also tried before other values, like 6h or 6d etc.

GET /tiles/1.0.0/osm/12/1035/1519.jpg HTTP/1.1
User-Agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:9.0.1)
Gecko/20100101 Firefox/9.0.1
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,en-us;q=0.7,pl;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Cookie: bblastvisit=1325618979; bblastactivity=0;
bbsessionhash=02acddda9354e88dd04bab92358aeca6; __utmc=26892847

HTTP/1.1 200 OK
Server: nginx/1.0.11
Date: Wed, 04 Jan 2012 19:52:01 GMT
Content-Type: image/jpeg
Connection: keep-alive
Content-Length: 8010
Cache-Control: max-age=600
Last-Modified: Wed, 04 Jan 2012 02:18:15 GMT
Expires: Wed, 04 Jan 2012 20:02:01 GMT


Posted at Nginx Forum:,220058,220808#msg-220808

More information about the nginx mailing list