Welcome! Log In Create A New Profile

Advanced

Re: 回复:Re:_回复:Re:_回复:Re:_Issue_about_nginx_r emoving_the_header_"Connection"_in_HTTP_response?

Aleksandar Lazic
March 07, 2017 02:40AM
Hi Liu Peng.

We still don't know your nginx version nor your config!

Cite from below:
> So now the standard Questions from me:
> What's the output of nginx -V ?
> What's your config?

regards
aleks

Am 07-03-2017 02:37, schrieb tjlp@sina.com:
> Hi, Alexks,
>
> 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.
>
> 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.
>
> 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.
>
> 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.
>
> Thanks
> Liu Peng
>
> ----- 原始邮件 -----
> 发件人:Aleksandar Lazic <al-nginx@none.at>
> 收件人:tjlp@sina.com
> 抄送人:nginx <nginx@nginx.org>
> 主题:Re:_回复:Re:_回复:Re:_Issue_about_nginx_removing_the_header_"Connection"_in_HTTP_response?
> 日期:2017年03月04日 17点22分
>
> Hi Liu Peng.
> Am 04-03-2017 09:12, schrieb tjlp@sina.com:
>>
>> Hi, Alexks,
>>
>> I don't want to hide the header.
>> My problem is that Nginx change the "Connection: close" header in the
>> reponse from upstream server to "Connction: keep-alive" and send to
>> client. I want to keep the original "Connection: close" header.
> Ah that's a clear question.
> It took us only 3 rounds to get to this clear question ;-)
> So now the standard Questions from me:
> What's the output of nginx -V ?
> What's your config?
> Maybe you have set 'keepalive' in the upstream config
> http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
> or
> 'proxy_http_version 1.1;'
> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_http_version
> as a last resort you can just pass the header with
> 'proxy_pass_header Connection;'.
> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_pass_header
> Choose the solution which fit's to your demand.
> I can only guess due to the fact that we don't know your config.
> May I ask you to take a look into this document, which exists in
> several
> languages, thank you very much.
> http://www.catb.org/~esr/faqs/smart-questions.html
> Best regards
> Aleks
>> Thanks
>> Liu Peng
>>
>> ----- 原始邮件 -----
>> 发件人:Aleksandar Lazic <al-nginx@none.at>
>> 收件人:tjlp@sina.com
>> 抄送人:nginx <nginx@nginx.org>
>> 主题:Re:_回复:Re:_Issue_about_nginx_removing_the_header_"Connection"_in_HTTP_response?
>> 日期:2017年03月03日 16点19分
>> Hi.
>>
>> then one directive upward.
>>
>> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_hide_header
>>
>> Cheers
>>
>> aleks
>>
>> Am 03-03-2017 06:00, schrieb tjlp@sina.com:
>>
>>> Hi,
>>>
>>> What I mention is the header in response from backend server. Your
>>> answer about proxy_set_header is the "Connection" header in request.
>>>
>>> Thanks
>>> Liu Peng
>>>
>>> ----- 原始邮件 -----
>>> 发件人:Aleksandar Lazic <al-nginx@none.at>
>>> 收件人:nginx@nginx.org
>>> 抄送人:tjlp@sina.com
>>> 主题:Re: Issue about nginx removing the header "Connection" in HTTP
>>> response?
>>> 日期:2017年03月03日 06点25分
>>>
>>> Hi.
>>> Am 01-03-2017 08:29, schrieb tjlp@sina.com:
>>>> Hi, nginx guy,
>>>>
>>>> In our system, for some special requests, the upstream server will
>>>> return a response which the header includes "Connection: Close".
>>>> According to HTTP protocol, "Connection" is one-hop header.
>>>> So, nginx will remove this header and the client can't do the
>>>> business
>>>> logic correctly.
>>>>
>>>> How to handle this scenario?
>>> you mean something like this?
>>> http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_set_header
>>> If the value of a header field is an empty string then this field
>>> will
>>> not be passed to a proxied server:
>>> proxy_set_header Connection "";
>>>> Thanks
>>>> Liu Peng
>>>> _______________________________________________
>>>> nginx mailing list
>>>> nginx@nginx.org
>>>> http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

回复:Re:_回复:Re:_回复:Re:_Issue_about_nginx_rem oving_the_header_"Connection"_in_HTTP_response?

Anonymous User March 06, 2017 08:40PM

Re: 回复:Re:_回复:Re:_回复:Re:_Issue_about_nginx_r emoving_the_header_"Connection"_in_HTTP_response?

Aleksandar Lazic March 07, 2017 02:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 150
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready