> ------------------------------
>
> Message: 10
> Date: Mon, 14 May 2012 19:57:00 +0100
> From: Francis Daly <francis@daoine.org>
> To: nginx@nginx.org
> Subject: Re: http upstream keepalives
> Message-ID: <20120514185700.GJ457@craic.sysops.org>
> Content-Type: text/plain; charset=us-ascii
>
> 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 http://172.16.7.9:2323;
>> }
>> }
>>
>> On 172.16.7.9 I launched:
>>
>> > nc -4 -l 172.16.7.9 2323
>>
>> And so I saw:
>> GET / HTTP/1.1
>> Host: 172.16.7.9:2323
>> 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.
>
Indeed you are right but I read
(http://nginx.org/en/docs/http/ngx_http_upstream_module.html#keepalive):
For HTTP, the proxy_http_version directive should be set to “1.1” and
the “Connection” header field should be cleared:
upstream http_backend {
server 127.0.0.1:8080;
keepalive 16;
}
server {
...
location /http/ {
proxy_pass http://http_backend;
proxy_http_version 1.1;
proxy_set_header Connection "";
...
}
}
So i was thinking that in this scenario all other proxy_set_header
options were inherited from the server stanza.
Clarify this point could help. That's all.
Thanks for your answers.
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx