Regression in 1.14 when following upstream redirects

Maxim Dounin mdounin at mdounin.ru
Wed May 16 14:40:09 UTC 2018


Hello!

On Wed, May 16, 2018 at 10:08:23AM -0400, vedranf wrote:

> Hey,
> 
> 
> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Hello!
> > 
> > On Mon, May 14, 2018 at 01:22:46PM -0400, vedranf wrote:
> > 
> > > There is a problem when nginx is configured to try to follow
> > redirects (301)
> > > from upstream server in order to cache responses being directed to,
> > rather
> > > than the short redirect itself. This worked in 1.12 and earlier
> > releases.
> > > Here is the simplified configuration I use and which used to work:
> > > 
> > 
> > From the incomplete configuration and debug log snippets you've 
> > provided it looks like your problem if that requests previously 
> > not cached now successfully extracted from cache.
> > 
> > From the snippets you've provided it is not possible to conclude 
> > if the previous behaviour was buggy and now fixed (and your 
> > previous configuration worked due to a bug), or the new behaviour 
> > is incorrect.
> > 
> > There are at least some fixes in 1.13.x which might affect your 
> > configuration.  In particular, this fix in 1.13.6 might be 
> > related:
> > 
> >     *) Bugfix: cache control headers were ignored when caching errors
> >        intercepted by error_page.
> 
> Right, this seems to be causing it. I was able to replicate it only when 3XX
> redirect had Cache-Control set. Please look at the minimal configuration at:
> https://pastebin.com/tSqH4YJt
> with 1.12 you always get 204 response from 127.0.0.1:8181, with 1.14 first
> response is 204, but the subsequent responses are 500 with invalid URL
> prefix in "" error because in the second attempt request never goes to
> upstream (perhaps it assumes file is supposed to be in cache) and the
> variable is empty.

Ok, thanks you for confirming.  So your configuration relied on a 
bug which is now fixed.  An obvious workaround would be to disable 
looking into Cache-Control / Expires headers using the 
proxy_ignore_headers directive (http://nginx.org/r/proxy_ignore_headers), 
so nginx will cache things only based on proxy_cache_valid.

-- 
Maxim Dounin
https://xkcd.com/1172/


More information about the nginx mailing list