Upstream timed out (110: Connection timed out) while proxying upgraded connection

Using nginx as a reverse proxy for the collabora office suite, I experienced this behavoir: leaving the document open and working on other windows, results in the following error on the web interface: We are sorry, this is an unexpected connection error Please try again.". Nothing to worry about, clicking “Ok” results in collabora to re-load the document, but this timeout is really annoying. WIth the nginx default configuration this is 60 seconds.

Enabling debug on nginx I found this warning:

2016/09/11 17:22:15 [info] 12751#0: *86 upstream timed out (110: Connection timed out) while proxying upgraded connection, client: …

This is nothing to worry about, but If you want increase this timeout (I used 10 minutes), insert this on your nginx.conf:

proxy_read_timeout 600s;

Now the error came out after 10 minutes instead of every minute. Better, isn’t it? It can be that you notice a second warning on the nginx log files:

2016/09/11 17:40:10 [warn] 14088#0: *24 a client request body is buffered to a temporary file /var/lib/nginx/body/0000000001, client:

Again, pretty normal if you loaded a document exceeding 64k (for a 64bit server), but it you want get rid of this warning and you’re not contrainst with your RAM, you can add this line to adjust the buffer size:

client_body_buffer_size 1m;