Welcome! Log In Create A New Profile

Advanced

Re: conditionally disable keepalives

Ryan Malayter
September 17, 2010 02:42PM
On Fri, Sep 17, 2010 at 12:20 PM, Ryan Malayter <malayter@gmail.com> wrote:
> On Fri, Sep 17, 2010 at 11:34 AM, Cliff Wells <cliff@develix.com> wrote:
>> Or you could run a second Nginx instance between them and the main Nginx
>> instance.
>
> I thought about that... I suppose I could even have the same nginx
> instance proxy to itself, as the source IP would change to localhost
> on the subrequest, but it seems wasteful and potentially brittle.

So, the "proxy back to another nginx" (in this case the same instance)
Cliff suggested seems to be working, and I get a "Connection: close"
header for the IPs I am interested in, and keepalives seem to be off.

However, I do not get see the header I add in my special location,
even though I know it is hitting that location via rewrite. Is
proxy_pass http://127.0.0.1 treated specially by nginx somehow? I
would also expect to see two entries in the log files for every
request, but I do not.

Here is what I have (streamlined config)

server {

if ($remote_addr ~ "^(111\.111\.111\.111|222\.222\.222\.222)$") {
rewrite ^(.*)$ /nokeepalive$1;
}

location /
#and and many other locations

location /nokeepalive {
keepalive_timeout 0;
add_header "X-NoKeepalive-Proxy" "true";
proxy_set_header Host $host;
#proxy back to myself at original request URI
rewrite /nokeepalive(.*)$ $1;
proxy_pass http://127.0.0.1;
}
}


--
RPM

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

conditionally disable keepalives

Ryan Malayter September 17, 2010 12:32PM

Re: conditionally disable keepalives

Cliff Wells September 17, 2010 12:38PM

Re: conditionally disable keepalives

Ryan Malayter September 17, 2010 01:24PM

Re: conditionally disable keepalives

Ryan Malayter September 17, 2010 02:42PM

Re: conditionally disable keepalives

Eugaia September 17, 2010 01:50PM

Re: conditionally disable keepalives

Maxim Dounin September 17, 2010 02:52PM

Re: conditionally disable keepalives

Eugaia September 17, 2010 03:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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