<div>Hi, Alexks,<br><div><br><div><div>I try your proposal and it doesn't work. Actually my issue is the same as this one http://stackoverflow.com/questions/5100971/nginx-and-proxy-pass-send-connection-close-headers.<br><br></div><div><div>1. I add "keeplive_request 0". The result is that the "Connection: close" header is sent to client for every response. That does not match my requirement. Our application decides whether to finish the application session using this header.<br><div><br><div>2. I add "proxy_pass_header Connection". Nginx keeps sending  "Connection: keep-alive" header to client even the header is "Connection: close" from upstream server.<br><br></div></div></div><div>Seems Nginx has some special handling for the Connection header in response. The openresty author suggests that the only way for changing response header change the nginx C code for this issue. See this issue: https://github.com/openresty/headers-more-nginx-module/issues/22#issuecomment-31585052.<br><div><br><div>Thanks<br>Liu Peng<br></div></div></div></div></div></div></div><div id="origbody"><div style="background: #f2f2f2;">----- 原始邮件 -----<br>发件人:Aleksandar Lazic <al-nginx@none.at><br>收件人:tjlp@sina.com<br>抄送人:nginx <nginx@nginx.org><br>主题:Re:_回复:Re:_回复:Re:_Issue_about_nginx_removing_the_header_"Connection"_in_HTTP_response?<br>日期:2017年03月04日 17点22分<br></div><br><br>Hi Liu Peng.<br>Am 04-03-2017 09:12, schrieb tjlp@sina.com:<br>> <br>> Hi, Alexks,<br>> <br>> I don't want to hide the header.<br>> My problem is that Nginx change the "Connection: close" header in the<br>> reponse from upstream server to "Connction: keep-alive" and send to<br>> client. I want to keep the original "Connection: close" header.<br>Ah that's a clear question.<br>It took us only 3 rounds to get to this clear question ;-)<br>So now the standard Questions from me:<br>What's the output of nginx -V ?<br>What's your config?<br>Maybe you have set 'keepalive' in the upstream config<br>http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive<br>or<br>'proxy_http_version 1.1;'<br>http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version<br>as a last resort you can just pass the header with<br>'proxy_pass_header Connection;'.<br>http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass_header<br>Choose the solution which fit's to your demand.<br>I can only guess due to the fact that we don't know your config.<br>May I ask you to take a look into this document, which exists in several<br>languages, thank you very much.<br>http://www.catb.org/~esr/faqs/smart-questions.html<br>Best regards<br>Aleks<br>> Thanks<br>> Liu Peng<br>> <br>> ----- 原始邮件 -----<br>> 发件人:Aleksandar Lazic <al-nginx@none.at><br>> 收件人:tjlp@sina.com<br>> 抄送人:nginx <nginx@nginx.org><br>> 主题:Re:_回复:Re:_Issue_about_nginx_removing_the_header_"Connection"_in_HTTP_response?<br>> 日期:2017年03月03日 16点19分<br>> Hi.<br>> <br>> then one directive upward.<br>> <br>> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header<br>> <br>> Cheers<br>> <br>> aleks<br>> <br>> Am 03-03-2017 06:00, schrieb tjlp@sina.com:<br>> <br>>> Hi,<br>>> <br>>> What I mention is the header in response from backend server. Your <br>>> answer about proxy_set_header is the "Connection" header in request.<br>>> <br>>> Thanks<br>>> Liu Peng<br>>> <br>>> ----- 原始邮件 -----<br>>> 发件人:Aleksandar Lazic <al-nginx@none.at><br>>> 收件人:nginx@nginx.org<br>>> 抄送人:tjlp@sina.com<br>>> 主题:Re: Issue about nginx removing the header "Connection" in HTTP <br>>> response?<br>>> 日期:2017年03月03日 06点25分<br>>> <br>>> Hi.<br>>> Am 01-03-2017 08:29, schrieb tjlp@sina.com:<br>>>> Hi, nginx guy,<br>>>> <br>>>> In our system, for some special requests, the upstream server will<br>>>> return a response which the header includes "Connection: Close".<br>>>> According to HTTP protocol, "Connection" is one-hop header.<br>>>> So, nginx will remove this header and the client can't do the <br>>>> business<br>>>> logic correctly.<br>>>> <br>>>> How to handle this scenario?<br>>> you mean something like this?<br>>> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header<br>>> If the value of a header field is an empty string then this field will<br>>> not be passed to a proxied server:<br>>> proxy_set_header Connection "";<br>>>> Thanks<br>>>> Liu Peng<br>>>> _______________________________________________<br>>>> nginx mailing list<br>>>> nginx@nginx.org<br>>>> http://mailman.nginx.org/mailman/listinfo/nginx<br></div>