Welcome! Log In Create A New Profile

Advanced

Re: Regression in 1.14 when following upstream redirects

Maxim Dounin
May 14, 2018 11:40PM
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:
>
> server { proxy_cache something;
> location / { proxy_pass http://upstream; }
> location @handle3XX {
> proxy_cache_key ...;
> set $target $upstream_http_location;
> proxy_pass $target;
> proxy_redirect off;
> internal;
> }}
>
> With 1.12 this would cause nginx to follow the redirect and return the
> response after the (absolute) redirect. With 1.14 something weird is going
> on, it returns 301 back to the client and upstream_cache_status variable is
> set to HIT (even though 3XX aren't configured to be cached at all). If I
> repeat the request, I get 500 with "invalid URL prefix in" because $target
> is now empty as it didn't connect to the upstream at all.
>
> Debug logs for the critical part show this below (trimmed). Common for both
> nginx versions:

[...]

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.

To further investigate things you may want to provide full
configuration which demonstrates the problem, and full debug logs
for requests in both versions.

Please avoid any modifications to configuration and debug logs.
If you want to keep some information private, consider reproducing
the problem in a sandbox without any private information instead.

--
Maxim Dounin
http://mdounin.ru/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Regression in 1.14 when following upstream redirects

vedranf May 14, 2018 01:22PM

Re: Regression in 1.14 when following upstream redirects

Maxim Dounin May 14, 2018 11:40PM

Re: Regression in 1.14 when following upstream redirects

vedranf May 16, 2018 10:08AM

Re: Regression in 1.14 when following upstream redirects

Maxim Dounin May 16, 2018 10:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 237
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready