Maxim Dounin
January 16, 2014 11:08AM
Hello!

On Thu, Jan 16, 2014 at 09:02:36AM -0500, rge3 wrote:

> Hi,
>
> I'm trying to use the proxy cache to store regular pages (200) from my web
> server so that when the web server goes into maintenance mode and starts
> returning 503 nginx can still serve the good page out of cache. It works
> great for a few minutes but then at some point (5 to 10 minutes in) nginx
> will overwrite the good 200 page in the cache with the bad 503 page and then
> start handing out the 503. Looking at my config I don't understand how a
> 503 could ever get written to cache but it is. And the 200 page was brand
> new (written 10 minutes before) so it shouldn't be the "inactive" time on
> the proxy_cache_path setting causing nginx to delete the good file. Can
> anyone tell me what I'm missing? Here are the relevant pieces of my
> config:

[...]

> # don't cache pages with php's session cookie
> proxy_no_cache $cookie_$GotSessionCookie;
>
> # bypass the cache if we get a X-NoCache header
> proxy_cache_bypass $http_nocache $cookie_$GotSessionCookie;
>
> proxy_cache_use_stale http_500 http_503 error timeout
> invalid_header updating;
> }
>
> I can't imagine how a 503 would ever get cached given those
> proxy_cache_valid lines but maybe I don't understand something. Thanks for
> any ideas!

An exiting cache can be bypassed due to proxy_cache_bypass in your
config, and 503 response can be cached if it contains
Cache-Control and/or Expires which allow caching.

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

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

A 503 page gets written to my proxy cache, overwriting the 200

rge3 January 16, 2014 09:02AM

Re: A 503 page gets written to my proxy cache, overwriting the 200

Maxim Dounin January 16, 2014 11:08AM

Re: A 503 page gets written to my proxy cache, overwriting the 200

rge3 January 16, 2014 02:50PM

Re: A 503 page gets written to my proxy cache, overwriting the 200

Maxim Dounin January 16, 2014 05:10PM

Re: A 503 page gets written to my proxy cache, overwriting the 200

rge3 January 17, 2014 07:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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