NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

后端 未结 11 1880
余生分开走
余生分开走 2020-11-28 19:47

I have Puma running as the upstream app server and Riak as my background db cluster. When I send a request that map-reduces a chunk of data for about 25K users and returns i

11条回答
  •  清酒与你
    2020-11-28 20:09

    You should always refrain from increasing the timeouts, I doubt your backend server response time is the issue here in any case.

    I got around this issue by clearing the connection keep-alive flag and specifying http version as per the answer here: https://stackoverflow.com/a/36589120/479632

    server {
        location / {
            proxy_set_header   X-Real-IP $remote_addr;
            proxy_set_header   Host      $http_host;
    
            # these two lines here
            proxy_http_version 1.1;
            proxy_set_header Connection "";
    
            proxy_pass http://localhost:5000;
        }
    }
    

    Unfortunately I can't explain why this works and didn't manage to decipher it from the docs mentioned in the answer linked either so if anyone has an explanation I'd be very interested to hear it.

提交回复
热议问题