Welcome! Log In Create A New Profile

Advanced

Re: proxy_store help requested

Maxim Dounin
March 12, 2014 07:50AM
Hello!

On Tue, Mar 11, 2014 at 12:46:18PM -0400, nginx_newbie_too wrote:

> Maxim, one last piece of advice requested. Would it be more proper to turn
> off i-m-s in the request body (by setting proxy_pass_request_headers to off
> in the downstream server configuration) instead of turning it off on the
> upstream server? I think that's more correct behavior, but I'm not sure.

Something like

proxy_set_header If-Modified-Since "";
proxy_set_header If-None-Match "";

on a frontend should be a good way to disable If-* in requests to
an upstream server. I would recommend to don't touch it at all
though, and just ignore 304 responses which are not stored.
Number of 304 returned by upstream should be small enough.

> Yes, proxy_cache simply works out of the box, and it's awesome. But I
> couldn't understand how to use it so that the downstream server doesn't
> naively GET content again from the upstream after the expiration time period
> had passed. I would have wanted instead to only have the cache refreshed if
> i-m-s suggested that the upstream content had changed.

To make proxy_cache behave more like proxy_store and ignore
response expiration, use proxy_ignore_headers (and
proxy_cache_valid to set cache time):

proxy_ignore_headers Cache-Control Expires;
proxy_cache_valid 200 365d;

Use of If-Modified-Since to revalidate cached data can be
activated by proxy_cache_revalidate directive.

See here for documentation:

http://nginx.org/r/proxy_set_header
http://nginx.org/r/proxy_ignore_headers
http://nginx.org/r/proxy_cache_valid
http://nginx.org/r/proxy_cache_revalidate


--
Maxim Dounin
http://nginx.org/

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

proxy_store help requested

nginx_newbie_too March 08, 2014 05:39PM

Re: proxy_store help requested

nginx_newbie_too March 08, 2014 05:45PM

Re: proxy_store help requested

nginx_newbie_too March 08, 2014 06:21PM

Re: proxy_store help requested

Maxim Dounin March 08, 2014 07:16PM

Re: proxy_store help requested

nginx_newbie_too March 08, 2014 08:51PM

Re: proxy_store help requested

nginx_newbie_too March 09, 2014 10:34PM

Re: proxy_store help requested

Maxim Dounin March 10, 2014 07:08PM

Re: proxy_store help requested

nginx_newbie_too March 11, 2014 12:46PM

Re: proxy_store help requested

Maxim Dounin March 12, 2014 07:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 118
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready