<div dir="ltr"><div><div><div>I sent an email to nginx@ also. <br></div>With your approach also don't work.  I mean "set $foo $upstream_http_location".<br></div>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.<br>
<br></div>So the config now is:<br>
http {<br>    proxy_intercept_errors on;<br><br>    proxy_cache_path /home/toli/nginx/run/cache keys_zone=zone_c1:256m inactive=5d max_size=30g;<br>   <br>    upstream up_servers {<br>        server <a href="http://127.0.1.1:8081" target="_blank">127.0.1.1:8081</a>;<br>

    }<br><br>    server {<br>        listen <a href="http://127.0.0.1:8080" target="_blank">127.0.0.1:8080</a>;<br>        set $foo "sasdfsdfsdf";<br><br>        location / {<br>            proxy_cache zone_c1;<br>
            proxy_pass <a href="http://127.0.1.1:8081" target="_blank">http://127.0.1.1:8081</a>;<br>
            proxy_temp_path tmp ;<br>            set $foo $upstream_http_location;<br>            error_page 301 302 307 @redir;<br>        }<br><br>        location @redir {<br>            proxy_cache zone_c1;<br>            proxy_pass $foo;<br>

            proxy_temp_path tmp ;<br>        }<br>    }<br>}<br><div><div><br></div><div>The issue appears again - 500 internal server error.<br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Fri, Oct 4, 2013 at 5:11 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello!<br>
<div class="im"><br>
On Fri, Oct 04, 2013 at 04:20:04PM +0300, Anatoli Marinov wrote:<br>
<br>
> Where I can ask for a help with this configuration?<br>
><br>
> I cannot manage to configure it.<br>
<br>
</div>The nginx@ list is intended for user questions, see<br>
<a href="http://nginx.org/en/support.html" target="_blank">http://nginx.org/en/support.html</a>.<br>
<br>
[...]<br>
<div class="im"><br>
> But I receive 500 internal server error and in the logs I have:<br>
> invalid URL prefix in ""<br>
> I think the variable $upstream_http_location is empty. Should I use<br>
> different variable?<br>
<br>
</div>You should save a value of the $upstream_http_location variable<br>
before upstream data will be reinitialized, e.g. via "set $foo<br>
$upstream_http_location".<br>
<div class="HOEnZb"><div class="h5"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/en/donation.html" target="_blank">http://nginx.org/en/donation.html</a><br>
<br>
_______________________________________________<br>
nginx-devel mailing list<br>
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel" target="_blank">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a><br>
</div></div></blockquote></div><br></div>