Welcome! Log In Create A New Profile

Advanced

Re: Nginx doesn't honor Cache-Control: no-cache _request_

August 03, 2009 07:17AM
On Mon, Aug 03, 2009 at 12:41:31PM +0200, Miros??aw Jaworski wrote:

> Hello
>
> RFC2616 14.9.4 Cache Revalidation and Reload Controls
> "End-to-end reload"
> [...]The server MUST NOT use a cached copy when responding to such a
> request[...]
>
> Such a request can be triggered from the browser by holding SHIFT
> and using reload button; it's often used by web developers to get
> uncached response from the original server. Unfortunately nginx seems
> to ignore such request and answers from the cache.
>
> Is it possible to make a quick workaround bypassing the cache for such
> requests using some request header variable conditional if?
>
> server {
> listen 127.0.0.1:8000;
> server_name localhost;
>
> location / {
> proxy_pass http://192.168.10.10:80/;
> proxy_redirect off;
>
> if ($request_header !~ "Cache-Control: no-cache") {
> proxy_cache one;
> proxy_cache_valid 200 1h;
> }
> proxy_pass_header Set-Cookie;
>
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> }
> }
>
> ?

No, currently nginx ignores the reload because everyone may flush
popular and heavy generated pages from your cache.
I plan to allow reload only from limited set of addresses.


--
Igor Sysoev
http://sysoev.ru/en/
Subject Author Posted

Nginx doesn't honor Cache-Control: no-cache _request_

Mirosław Jaworski August 03, 2009 06:41AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

Igor Sysoev August 03, 2009 07:17AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

Mirosław Jaworski August 03, 2009 08:28AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

Igor Sysoev August 03, 2009 08:34AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

Mirosław Jaworski August 04, 2009 05:24AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

?? August 03, 2009 09:01AM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

杨镭 March 01, 2010 01:16PM

Re: Nginx doesn't honor Cache-Control: no-cache _request_

pf shineyear March 07, 2010 12:56PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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