keep-alive confused

kevin_wangxk at sina.cn kevin_wangxk at sina.cn
Fri Feb 13 06:55:38 UTC 2015


hello,

     I use nginx as a reverse proxy, and I find a question that confused me.

     In upstream loction I use keepalive direction to keep a connection pool. As everyone knows,
that can reduse tcp handshake cost. When I send request with "Connection: keep-alive" header
using http /1.0 protocal to nginx, I find nginx transmits the request to backend with "Connection: close"
header. You know, "Connection: close" header will lead backend close the connection, and keepalive
direction cannt work.

for example below:
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
GET /2/proxyauth/auth.json?source=84883&&access_token=2.00JGc2QCCPl5PDe1e566dDfAD&object_id=1022:100101B2094650D064A0F5469D&uid=1042:2673106753&auth_type=option HTTP/1.0
Connection: keep-alive
Client-Uri: /2/proxy/darwin/movie/mblog_list.json?source=848343583&&access_token=2.00JGc2QCCPl5PDe1e566d3b9NzDfAD&object_id=1022:100101B2094650D064A0F5469D&uid=1042:2673106753
Client-Host: localhost
Host: oauthweibo
User-Agent: curl/7.22.0 (x86_64-pc-linux-gnu) libcurl/7.22.0 OpenSSL/1.0.1 zlib/1.2.3.4 libidn/1.23 librtmp/2.3
Accept: */*


HTTP/1.1 200 OK
Server: nginx/1.6.2
Date: Fri, 13 Feb 2015 06:47:39 GMT
Content-Type: application/json;charset=UTF-8
Connection: close
Api-Server-IP: 10.75.25.127
Vary: Accept-Encoding
/////////////////////////////////////////////////////////////////////////////////////

     Anybody meet that problem? Ideas anyone? thanks very much.

     When nginx transmits requests to backend, it uses http /1.0 protocal. Why is that?

     Thanks.
     
------------------
 
Regards!
xiaokai


More information about the nginx mailing list