nginx usptream 302 redirect

Anatoli Marinov a.marinov at ucdn.com
Fri Oct 4 14:51:32 UTC 2013


I sent an email to nginx@ also.
With your approach also don't work.  I mean "set $foo
$upstream_http_location".
I use this in the first location block and in the second I used $foo
instead of $upstream_http_location but it is also empty and I get 500 again.

So the config now is:
http {
    proxy_intercept_errors on;

    proxy_cache_path /home/toli/nginx/run/cache keys_zone=zone_c1:256m
inactive=5d max_size=30g;

    upstream up_servers {
        server 127.0.1.1:8081;
    }

    server {
        listen 127.0.0.1:8080;
        set $foo "sasdfsdfsdf";

        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 ;
        }
    }
}

The issue appears again - 500 internal server error.


On Fri, Oct 4, 2013 at 5:11 PM, Maxim Dounin <mdounin at mdounin.ru> wrote:

> Hello!
>
> On Fri, Oct 04, 2013 at 04:20:04PM +0300, Anatoli Marinov wrote:
>
> > Where I can ask for a help with this configuration?
> >
> > I cannot manage to configure it.
>
> The nginx@ list is intended for user questions, see
> http://nginx.org/en/support.html.
>
> [...]
>
> > But I receive 500 internal server error and in the logs I have:
> > invalid URL prefix in ""
> > I think the variable $upstream_http_location is empty. Should I use
> > different variable?
>
> You should save a value of the $upstream_http_location variable
> before upstream data will be reinitialized, e.g. via "set $foo
> $upstream_http_location".
>
> --
> Maxim Dounin
> http://nginx.org/en/donation.html
>
> _______________________________________________
> nginx-devel mailing list
> nginx-devel at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20131004/d2c50f24/attachment.html>


More information about the nginx-devel mailing list