Nginx Caching Error Response Code like 400 , 500 , 503 ,etc
Valentin V. Bartenev
vbart at nginx.com
Sun Aug 7 20:34:25 UTC 2016
On Sunday 07 August 2016 08:43:04 anish10dec wrote:
> Hi Everyone,
> We are using Nginx as Caching Server .
> As per Nginx Documentation by default nginx caches 200, 301 & 302 response
> code but we are observing that if Upstream server gives error 400 or 500 or
> 503, etc , response is getting cached and all other requests for same file
> becomes HIT.
No, the nginx documentation doesn't say this.
A quote from the docs:
| Parameters of caching can also be set directly in the response header.
| This has higher priority than setting of caching time using the directive.
The "200, 301 & 302" codes are mentioned in the "proxy_cache_valid"
directive when only the "time" parameter is specified.
wbr, Valentin V. Bartenev
More information about the nginx