Maxim Dounin
January 04, 2012 10:20PM
Hello!

On Wed, Jan 04, 2012 at 03:12:10PM -0500, piotr wrote:

> Maxim,
>
> Sorry for the late response.
>
> I'm trying to hide those headers, you can see it in config posted
> before:
>
> 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.

You don't hide the headers, and don't set headers in config. The
proxy_ignore_headers instruct nginx to ignore headers in question
(i.e. don't set/limit cache validity time as stored in cache
metadata based on these headers). The proxy_cache_valid
directives set cache validity times. None of these directives
hide or modify headers in question.

To hide headers, you have to use the proxy_hide_header directive
(as already suggested in previous message), see here for details:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header

To explicitly set Cache-Control/Expires headers, use the "expires"
directive, see here for details:

http://wiki.nginx.org/HttpHeadersModule#expires

(no official docs in English yet)

> 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.

Do you request the file in question with interval larger than 600
seconds, without any intermediate requests? It is expected to be
removed from cache as inactive one in such test, see desciption of
the "inactive" parameter of the "proxy_cache_path" directive here:

http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path

Try requesting a file once per minute to keep it active.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

proxy_ignore_headers doesn't seem to work

piotr December 14, 2011 11:34AM

Re: proxy_ignore_headers doesn't seem to work

Maxim Dounin December 14, 2011 12:10PM

Re: proxy_ignore_headers doesn't seem to work

piotr December 16, 2011 09:11AM

Re: proxy_ignore_headers doesn't seem to work

Maxim Dounin December 18, 2011 06:18AM

Re: proxy_ignore_headers doesn't seem to work

piotr January 04, 2012 03:12PM

Re: proxy_ignore_headers doesn't seem to work

Francis Daly January 04, 2012 05:28PM

Re: proxy_ignore_headers doesn't seem to work

Francis Daly January 04, 2012 06:14PM

Re: proxy_ignore_headers doesn't seem to work

Maxim Dounin January 04, 2012 10:20PM

Re: proxy_ignore_headers doesn't seem to work

piotr January 09, 2012 01:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 311
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready