# Increasing timeouts causes browser to endlessly wait for a response

**URL:** <https://www.ruby-forum.com/t/increasing-timeouts-causes-browser-to-endlessly-wait-for-a-response/155181>\
**Category:** NGINX\
**Created:** [December 9, 2008, 2:27am UTC](https://www.ruby-forum.com/t/increasing-timeouts-causes-browser-to-endlessly-wait-for-a-response/155181 "2008-12-09T02:27:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Cocoa\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a87d85/32.png) [@Cocoa\_G](https://www.ruby-forum.com/u/Cocoa_G)\
**Post date:** [December 9, 2008, 2:27am UTC](https://www.ruby-forum.com/t/increasing-timeouts-causes-browser-to-endlessly-wait-for-a-response/155181/1 "2008-12-09T02:27:07Z")

</div>

Hi,

I’m running nginx 0.7.24 along with Mongrel. On an admin, non public  
facing site, I have tasks that involve lots of computation and can  
take up to 15-30 minutes to run.

I’ve configured nginx to wait a long while for a response from  
Mongrel, but what happens is that Mongrel will complete the task, but  
nothing is returned to the browser. It just sits there as if the  
operation is still running.

Below is my configuration. This is what I’m using to increase the  
timeout:  
proxy\_connect\_timeout 3600;  
proxy\_send\_timeout 3600;  
proxy\_read\_timeout 3600;  
keepalive\_timeout 3600;  
proxy\_next\_upstream off;

I’ve been trying to get this to work for over a day, so any hints are  
greatly appreciated.  
Cheers!

* * *

http {  
include mime.types;  
default\_type application/octet-stream;

```
log_format main '$remote_addr - $remote_user [$time_local] 

```

$request ’  
'"$status" $body\_bytes\_sent “$http\_referer” ’  
‘"$http\_user\_agent" “$http\_x\_forwarded\_for”’;

```
access_log logs/access.log main;

sendfile on;

gzip on;
gzip_http_version 1.0;
gzip_comp_level 2;
gzip_proxied any;
gzip_types text/plain text/html text/css

```

application/x-javascript text/xml application/xml application/xml+rss  
text/javascript;

```
upstream mongrel {
  server 127.0.0.1:8000;
  server 127.0.0.1:8001;
  server 127.0.0.1:8002;
}

server {
    listen 3000;
    server_name blah.com;
    root /blah/cache;

    if (-f $document_root/system/maintenance.html) {
      rewrite ^(.*)$ /system/maintenance.html last;
      break;
    }

    location / {
        proxy_set_header CLIENT_IP $remote_addr;
        proxy_set_header Host $http_host;

        proxy_connect_timeout 3600;
        proxy_send_timeout 3600;
        proxy_read_timeout 3600;
        keepalive_timeout 3600;
        proxy_next_upstream off;

        if (-f $request_filename) {
          break;
        }

        if (-f $request_filename/index.html) {
          rewrite (.*) $1/index.html break;
        }

        if (-f $request_filename.html) {
          rewrite (.*) $1.html break;
        }

        if (!-f $request_filename) {
          proxy_pass http://mongrel;
          break;
        }
    }

    error_page 500 502 503 504 /50x.html;
    location = /50x.html {
        root html;
    }
}

```

}

---

<div class="post-metadata">

**Author:** ![Cocoa\_G](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/a87d85/32.png) [@Cocoa\_G](https://www.ruby-forum.com/u/Cocoa_G)\
**Post date:** [December 9, 2008, 2:34am UTC](https://www.ruby-forum.com/t/increasing-timeouts-causes-browser-to-endlessly-wait-for-a-response/155181/2 "2008-12-09T02:34:44Z")

</div>

Not nginx related but have you thought about redesigning the  
architecture so that the connection basically queues the request, then  
the browser is told to refresh every so often and it will check the  
status until it is completed?

Seems more scalable than an app that relies on the web connection  
staying open for 30-60+ minutes
