Prevent caching of 301 redirects

Hi

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
place.

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?

thanks
Pete

Posted at Nginx Forum: