Welcome! Log In Create A New Profile

Advanced

How to close connection from a proxy

Posted by mworrell 
How to close connection from a proxy
May 13, 2009 04:36PM
Hi,

I use nginx to reverse proxy to an erlang web server.

To be able to use an Ajax file upload with Safari I have to serve a response with the "Connection: close" header. When I send this header from my web server nginx will replace it with a keep-alive.

Is it possible for the proxied web server to force nginx to close the connection with the user agent?

Greetings,

Marc Worrell
Re: How to close connection from a proxy
May 13, 2009 07:35PM
I'm not an expert, but try setting:

location / {

proxy_pass http://127.0.0.1:8000;

...

keepalive_timeout 0 0;

}

where http://127.0.0.1:8000 is the address:port of your erlang web server.

Nginx defaults to keep_alive of 75 seconds.

If that doesn't work, try adding:

add_header Connection close;

--
Jim Ohlstein
Re: How to close connection from a proxy
May 13, 2009 07:53PM
Thanks Jim,

I'm rather new to Nginx and I've found a small workaround that is almost like your proposal. Except that your proposal is more generic (and probably better).

I have added:

[code]
location /close-connection {
keepalive_timeout 0;
empty_gif;
}
[/code]

Which is effective for the jQuery form uploader.

Thanks,

Marc
Re: How to close connection from a proxy
May 13, 2009 08:06PM
If it works that's what counts.

Welcome to the club. :)

--
Jim Ohlstein
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 215
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