Forum: NGINX How to setup nginx to follow 302

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Anatoli Marinov (Guest)
on 2013-10-07 10:57
(Received via mailing list)
Hello colleagues,
Last week I tried to configure nginx to follow 302 through upstream
of relay it to the client.
My config now is like the next one:

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

    upstream up_cdn_cache_l2 {
        server weight=100;

    server {


        location / {
            proxy_cache zone_c1;
            proxy_temp_path tmp;
            error_page 301 302 307 @redir;

        location @redir {
            set $foo $upstream_http_location;
            proxy_pass $foo;
            proxy_cache zone_c1;
            proxy_temp_path tmp ;

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
not http request over this connection and after some time 504: Gateway
Time-out is received.
So at the client site I receive "504: Gateway Time-out."

Do you have any idea why nginx dont send http request to the second
This topic is locked and can not be replied to.