Tornado Stream Error

OK, I just told my web server to keep the socket alive for 7 days (likely overkill), but in case anyone else runs into this, here is how to configure NGINX:

Assume you run your application like this:

$ panel serve my_app.py --port=6000 --allow-websocket-origin=server_name.com

And you have NGINX configured like this:

        location /my_app {
                proxy_pass http://localhost:6000;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection "upgrade";
                proxy_http_version 1.1;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header Host $host:$server_port;
                proxy_buffering off;
                proxy_connect_timeout 7d; 
                proxy_send_timeout 7d; 
                proxy_read_timeout 7d; 

                access_log  /var/log/nginx/server_name.my_app.access.log;
                error_log   /var/log/nginx/server_name.my_app.error.log debug;
        }   

These three lines:

                proxy_connect_timeout 7d; 
                proxy_send_timeout 7d; 
                proxy_read_timeout 7d; 

seem to do the trick.

Here, a more helpful error message would have been nice … or a book so I can start understanding the web better :frowning:

1 Like