<div dir="ltr"><div><div>Hello colleagues, <br></div>Last week I tried to configure nginx to follow 302 through upstream instead of relay it to the client.<br></div><div>My config now is like the next one:<br><br><br>http {<br>
proxy_cache_path /home/toli/nginx/run/cache keys_zone=zone_c1:256m inactive=5d max_size=30g;<br><br> upstream up_cdn_cache_l2 {<br> server <a href="http://127.0.1.1:8081">127.0.1.1:8081</a> weight=100;<br> }<br>
<br> server {<br><br> listen <a href="http://127.0.0.1:8080">127.0.0.1:8080</a>;<br> resolver 8.8.8.8;<br><br> location / {<br> proxy_cache zone_c1;<br> proxy_pass <a href="http://127.0.1.1:8081">http://127.0.1.1:8081</a>;<br>
proxy_temp_path tmp;<br> error_page 301 302 307 @redir;<br> }<br><br> location @redir {<br> set $foo $upstream_http_location; <br> proxy_pass $foo;<br> proxy_cache zone_c1;<br>
proxy_temp_path tmp ;<br> }<br> }<br>}<br><br></div><div>With this config ginx is trying to connect to the server taken from location header. In wireshark I found new tcp connection to it but there is not http request over this connection and after some time 504: Gateway Time-out is received.<br>
</div><div>So at the client site I receive "504: Gateway Time-out."<br><br></div><div>Do you have any idea why nginx dont send http request to the second server?<br><br><br><br></div></div>