corrupted cache file: proxy_cache_valid ignored
Maxim Dounin
mdounin at mdounin.ru
Tue Feb 8 13:29:50 UTC 2022
Hello!
On Mon, Feb 07, 2022 at 11:39:08PM -0800, Roger Fischer wrote:
> we have observed a case where it seems that the
> proxy_cache_valid directive is ignored.
>
> nginx version: 1.19.9
>
> Config: proxy_cache_valid 200 206 30d;
>
> Scenario:
> * A cache file was corrupted (a file system issue). A part of
> the section that contains the headers had been overwritten with
> binary data.
> * The resource represented by the corrupted cache file is
> requested.
> * NGINX detects the corrupted cache file, and proxies the
> request upstream.
> * The request is rejected by the upstream, with the upstream
> returning a 403 status.
> * The 403 is returned to the client.
> This is all good, but
> * The request is repeated, and a cached 403 is returned, despite
> only caching 200 and 206.
> * Upon examination, the cache file contains the 403 response
> from upstream.
>
> Has anyone else seen something like this? Could this possibly be
> a bug?
As long as you don't have corresponding proxy_ignore_headers in
your configuration, cache validity can be also set by the response
itself: via Cache-Control, Expires, and X-Accel-Expires headers.
Check the response headers in the cache file to see if there are
any of these.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list