Prevent caching of 301 redirects

petestorey nginx-forum at
Thu Apr 16 11:04:55 UTC 2015


I'm running nginx as a reverse proxy for a website, and we have an
occasional problem where one of the back end servers occasionally sends an
errant 301 with caching headers as the home page for the site.  nginx then
caches this and responds to any requests with this redirect to the wrong

I've rtfm and clearly need to use proxy_no_cache and proxy_cache_bypass, but
I'm none the wiser on how to actually format it for this, or indeed whether
it's possible to control based on the http response code?


Posted at Nginx Forum:,258089,258089#msg-258089

More information about the nginx mailing list