nginx proxy "504 Gateway Time-Out"

chrisnx nginx-forum at
Tue Jul 21 22:48:51 MSD 2009


I'm trying to proxy a location to a backend COMET server. The COMET server holds long connections, and as such, I need nginx to proxy the connection indefinitely.

However, I always get a "504 Gateway Time-Out" after about a minute. Does anyone know why? Help would be greatly appreciated.

Here's my site conf:

upstream comet {

            location /comet_long_polling {
                # passes the request to node.js
                proxy_pass http://comet;


Here's my proxy.conf:

    proxy_redirect              off;                                                                                                                         
    proxy_set_header            Host $host;
    proxy_set_header            X-Real-IP $remote_addr;
    proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;
    client_max_body_size        10m;
    client_body_buffer_size     128k;
    proxy_connect_timeout       6000;
    proxy_send_timeout          6000;
    proxy_read_timeout          6000;
    proxy_buffer_size           4k;
    proxy_buffers               4 32k;
    proxy_busy_buffers_size     64k;
    proxy_temp_file_write_size  64k;
    send_timeout                6000;
    proxy_buffering             off;


Posted at Nginx Forum:,4290,4290#msg-4290

More information about the nginx mailing list