client closed prematurely connection while sending to client, in nginx

后端 未结 6 1993
名媛妹妹
名媛妹妹 2021-01-31 16:51

I have error in nginx error.log:

2010/12/05 17:11:49 [info] 7736#0: *1108 client closed prematurely connection while sending to client, 
client: 188.72.80.201, s         


        
相关标签:
6条回答
  • 2021-01-31 17:16

    fastcgi_ignore_client_abort on will definitely solve the issue.

    0 讨论(0)
  • 2021-01-31 17:26

    I had same problem, found that nginx closes the connection because of send_timeout setting. I increased and it is fixed.

    http
    {
    send_timeout 20;
    ...
    }
    
    0 讨论(0)
  • 2021-01-31 17:27

    I had the same problem and researched on it. In my case this only happens with Webkit (Chrome) browsers. They open connections optimistically more connections than they require if you only load a single resource. In such a case, the excess connection is closed ungracefully or at least without sending any HTTP verb over it. This leads to the mentioned error in nginx.

    Regarding #1 answer: Non of the proposed solutions help which is logical as this has nothing to do with proxying.

    Regarding #2 answer: proxy_ignore_client_abort on; Does not help in my test.

    Unfortunately, I've found no other solution than using

    error_log off;

    0 讨论(0)
  • 2021-01-31 17:29

    I tackled this problem myself for long hours today and found a solution:
    Please note that this fix only affects you when using load balancer(s)

    Check your load balancer idle timeout. I had ELB idle timeout set to 60 seconds (default) and as the request was hanging, it closed the connection after given time. But as the ELB is before nginx, nginx is logging that the "client" (in this case ELB), is closing the connection.

    So if you are using ELB, go to:
    EC2 -> Load Balancers -> Select the correct one -> scroll down in description and change Idle Timeout if you are using other load balancers, check their configuration and timeouts.

    Also keep in mind that you still might be needing to change the proxy timeouts etc.

    0 讨论(0)
  • 2021-01-31 17:29

    Setting proxy_ignore_client_abort on; might help you.

    0 讨论(0)
  • 2021-01-31 17:37

    I found that if you turn off the proxy buffer helps

    http {
       proxy_buffering off;
    ...
    }
    

    Probably the buffers are too small or less. After changing the buffer sizes it works nice

    proxy_buffering on;
    proxy_buffer_size 8k;
    proxy_buffers 2048 8k;
    
    0 讨论(0)
提交回复
热议问题