proxy_ignore_client_abort on; not working as expected
Maxim Dounin
mdounin at mdounin.ru
Thu Sep 8 21:25:38 UTC 2016
Hello!
On Thu, Sep 08, 2016 at 06:44:04PM +0000, Yun Wang wrote:
> Hi,
>
> We have a client that uses a half-close connection to get response from
> the server, but nginx closes the connection to the client without
> waiting for the response from server, even
> the proxy_ignore_client_abort is set to on. Without nginx in between,
> things work fine.
>
> Here are the events:
> 1. Client establishes the connection (SYN, SYN ACK, ACK).
> 2. Client closes _half_ of the connection by sending a FIN/ACK packet.
> 3. Nginx receives the FIN/ACK from the client, forwards it to the
> server, and responds to the client with a FIN/ACK right afterwards,
> which closes the connection on its own.
> 4. When server starts sending data to the client, nginx responds with
> a RST because the client side connection has been closed.
>
> Here is the config file I'm using:
>
> events {
> worker_connections 1024;
> }
> http {
> upstream proxy {
> keepalive 1;
> server 172.17.0.1:8089;
> }
> map $http_upgrade $connection_upgrade {
> default upgrade;
> '' "";
> }
> server {
> listen 7001;
> proxy_ignore_client_abort on;
> location / {
> proxy_pass [1]http://proxy;
> proxy_set_header Connection $connection_upgrade;
> proxy_set_header Upgrade $http_upgrade;
> proxy_http_version 1.1;
> }
> }
> }
>
> From the documentation, proxy_ignore_client_abort seems to be the
> perfect match for this scenario, but I'm not sure why it's not working
> for our setup.
>
> Any suggestion is appreciated!
Your config suggests that you are probably see the problem with
the upgraded connections. Upgraded connections are closed
once any party (either client or server) closes the connection and
there are no pending data. The proxy_ignore_client_abort
directive doesn't apply to upgraded connections.
--
Maxim Dounin
http://nginx.org/
More information about the nginx-devel
mailing list