nginx usptream 302 redirect

Maxim Dounin mdounin at mdounin.ru
Fri Oct 4 15:13:40 UTC 2013


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



More information about the nginx mailing list