Welcome! Log In Create A New Profile

Advanced

Re: nginx usptream 302 redirect

Maxim Dounin
October 04, 2013 11:14AM
Hello!

On Fri, Oct 04, 2013 at 05:33:57PM +0300, Anatoli Marinov wrote:

[...]

> From dev mail list Maxim advised me to backup $upstream_http_location in
> other variable and I did it but the result was the same - 500 internal
> server error. The config after the fix is:

[...]

> location / {
> proxy_cache zone_c1;
> proxy_pass http://127.0.1.1:8081;
> proxy_temp_path tmp ;
> set $foo $upstream_http_location;
> error_page 301 302 307 @redir;
> }
>
> location @redir {
> proxy_cache zone_c1;
> proxy_pass $foo;
> proxy_temp_path tmp ;
> }

You need "set ... $upstream_http_location" to be executed after a
request to an upstream was done, so you need in location @redir,
not in location /.

--
Maxim Dounin
http://nginx.org/en/donation.html

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

nginx usptream 302 redirect

Anatoli Marinov October 04, 2013 10:36AM

Re: nginx usptream 302 redirect

Maxim Dounin October 04, 2013 11:14AM

Re: nginx usptream 302 redirect

Mingcai SHEN March 18, 2015 09:46PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 144
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