Welcome! Log In Create A New Profile

Advanced

Re: Nginx http proxy caching

Ryan Malayter
May 10, 2010 05:58PM
On Mon, May 10, 2010 at 2:15 PM, Igor Sysoev <igor@sysoev.ru> wrote:
> On Mon, May 10, 2010 at 03:02:09PM -0400, Jim Ursetto wrote:
>
>> Vinay Y S Wrote:
>> -------------------------------------------------------
>> > Hi,
>> > Is there developer documentation on how http
>> > caching works in nginx? I'm
>> > seeing weird caching behavior where it's caching
>> > responses with Cache-Control: private headers.
>>
>> nginx completely ignores the `private` keyword and
>> will cache your document regardless.
>>
>> > As I've asked in another thread, I'm also trying
>> > to understand how I can
>> > enable/disable caching per request based on a
>> > cookie or a header set by
>> > upstream server.
>>
>> You can send `Cache-control: max-age=0` or
>> `Cache-control: no-cache` to disable nginx proxy cache.
>>
>> Note that because `private` is ignored, you cannot tell
>> nginx to not use the proxy cache while still allowing
>> the browser to cache (for example,
>> `Cache-control: max-age=3600, private`).  You can only
>> disable the proxy cache in the configuration file based
>> on the current Location.  I don't really understand this
>> behavior; I think private should be honored.
>
> You are right, "private" should be ignored.
> However, you may say nginx "X-Accel-Expires: 0" to not cache such
> responses. You may say different cache times for nginx and
> browsers/transit proxies:
>
> X-Accel-Expires: 500
> Cache-Control: max-age=100

Ach... is this really true? It is a fundamental HTTP spec violation to
ignore "private" cache-control directives in a proxy (even a reverse
proxy I would think).

It says in the documentation that it will obey cache-control headers here:
http://wiki.nginx.org/NginxHttpProxyModule#proxy_cache

Is the documentation incorrect? Are "private", "no-transform",
,"proxy-revalidate", and other such headers are ignored by nginx? I
just introduced caching into our QA environment for a whole site,
expecting sane behavior on the part of nginx. I guess I better do some
multi-user testing or roll it back out of caution...


--
RPM

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

Nginx http proxy caching

Vinay Y S January 19, 2010 01:00AM

Re: Nginx http proxy caching

Jim Ursetto May 10, 2010 03:02PM

Re: Nginx http proxy caching

Igor Sysoev May 10, 2010 03:24PM

Re: Nginx http proxy caching

Jim Ursetto May 10, 2010 03:43PM

Re: Nginx http proxy caching

Jim Ursetto May 10, 2010 03:46PM

Re: Nginx http proxy caching

Ryan Malayter May 10, 2010 05:58PM

Re: Nginx http proxy caching

Maxim Dounin May 10, 2010 09:10PM

Re: Nginx http proxy caching

Ryan Malayter May 14, 2010 09:16AM

Re: Nginx http proxy caching

Ryan Malayter May 14, 2010 10:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 87
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