Welcome! Log In Create A New Profile

Advanced

proxy_cache_valid inheritance

Posted by Jérôme Loyet 
Jérôme Loyet
proxy_cache_valid inheritance
June 18, 2010 06:32PM
Hi,

I have a question about the proxy_cache_valid inheritance. I have the
following configuration:

http {
...
proxy_cache_valid 301 1h;
proxy_cache_valid 200 302 404 10m;
proxy_cache_valid any 1m;
...
server {
proxy_cache mycache;

location /test {
proxy_pass http://$backend;
}

location /bar {
proxy_pass http://$backend;
proxy_cache_valid 5m;
}

location /foo {
proxy_pass http://$backend;
proxy_cache_valid 200, 301, 302, 404 5m;
}
}
}

In this conf:

- /test will be cache with 1h for 301, 10m for 200/302/404 and 1m for
the other types of response

How will be cahed requests to /foo ?
- 200, 301, 302 = 5m, others won't be cached ?
- 200, 301, 302 = 5m, 404 = 10m (as set in http{}) and others will be
cached for 1m (as set in http{}) ?

How will be cahed requests to /bar ?
- 200, 301, 302, 404 = 5m, others won't be cached ?
- 200, 301, 302, 404 = 5m, others will be cached for 1m (as set in http{}) ?

I don't know if setting proxy_cache_valid in location{} will totaly
overwritten proxy_cache_valid from http{} or just overwritten
specified values ?

Thx a lot
++ Jerome

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Piotr Sikora
Re: proxy_cache_valid inheritance
June 18, 2010 07:34PM
Hi,

> I don't know if setting proxy_cache_valid in location{} will totaly
> overwritten proxy_cache_valid from http{} or just overwritten
> specified values ?

First one. If you've got at least one "proxy_cache_valid" directive in your
location {} block then only options set in that location {} block will be
used. This rule applies to most of the nginx settings.

Best regards,
Piotr Sikora < piotr.sikora@frickle.com >



_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 79
Record Number of Users: 10 on August 27, 2010
Record Number of Guests: 177 on August 21, 2010
Powered by nginx    Powered by FreeBSD    PHP Powered    Powered by MySQL