nginx 502 error

错误信息:upstream prematurely closed connection while reading response header from upstream,

Symptom: nginx normally receives the request, normal call back interfaces, the interface returns to normal obtain information, but the request has been interrupted

solution:

  location / {

    proxy_http_version 1.1;

    proxy_set_header Connection "Keep-Alive";

  }

the reason:

  nginx defaults http1.0 get a response returned from the back end to the client, but does not support HTTP1.0 keepalive;

  Default proxy_set_header Connection close: close the connection to the backend server is active, this will cause a client requests any have had a TIME-WAIT state on the backend server connection

Guess you like

Origin www.cnblogs.com/xiufengd/p/11288542.html