Welcome! Log In Create A New Profile


Re: http upstream keepalives

Francis Daly
May 14, 2012 02:58PM
On Mon, May 14, 2012 at 07:32:18PM +0200, Davide D'Amico wrote:

Hi there,

> Hi, I'm reading here:
> http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive
> so I've tried:
> server {

> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

> location / {
> proxy_http_version 1.1;
> proxy_set_header Connection "";

That proxy_set_header directive means that any at an enclosing scope
are not relevant in this location{}.

> proxy_pass;
> }
> }
> On I launched:
> > nc -4 -l 2323
> And so I saw:
> GET / HTTP/1.1
> Host:
> User-Agent: Wget/1.12 (darwin10.5.0)
> Accept: */*
> As you can see the Host header is wrong so I tested this vhost:

No, the Host: header is what you configured it to be.

As your next example also shows.

> So I think that a little modification to documentation could be a good
> idea :)

The documentation you link to looks correct to me.

(As I read it, it says "Last-Modified: Mon, 23 Apr 2012 13:32:31 GMT".)

It includes "..." where you include specific directives. It turns out that
the specific directives you include don't do what you expected them to.

So: what documentation update could have avoided your confusion, or
adjusted your expectations to match what nginx actually does?

Note that this is unrelated to the "keepalive" directive; it is arguably
related to the proxy_set_header directive; but it is probably more
generally related to directive inheritance in nginx.

Some directives don't inherit at all -- so if you want it to apply in
a location{}, you must set it in that location.

Some directives do inherit from http > server > location -- so to see
whether it applies in a location{}, you may have to check enclosing
scopes too.

Some (few) directives are "paired", and will affect the inheritance of a
different directive -- so to see whether it applies in a location{}, you
have to check its partner directive too, possibly in enclosing scopes.

But for all(?) directives that do inherit, inheritance is by replacement,
not addition.

Where would you have looked to find notes like the above? Perhaps if a
suitable place can be identified, a corrected version could be put there.

Francis Daly francis@daoine.org

nginx mailing list
Subject Author Posted

http upstream keepalives

davide.damico May 14, 2012 01:34PM

Re: http upstream keepalives

Valentin V. Bartenev May 14, 2012 02:28PM

Re: http upstream keepalives

Francis Daly May 14, 2012 02:58PM

Re: Re: http upstream keepalives

davide.damico May 15, 2012 12:26AM

Sorry, only registered users may post in this forum.

Click here to login

Online Users

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