proxy_set_header at http level

Maxim Dounin mdounin at
Wed Jan 5 20:09:21 MSK 2011


On Wed, Jan 05, 2011 at 10:42:09PM +0800, 杨镭 wrote:

> Hi all,
>   Although the documentation (
> says the context of
> proxy_set_header  can be http, server, location,we found that
> proxy_set_header directive at http level does not work. When moved to server
> level, everything works fine.
>   Setting proxy_set_header at http level allows us to centralize some common
> settings thus avoid manually copy those directives to each virtual host when
> it was created. e.g., we use X-Http-Scheme header to let backend server know
> if it's a https request, otherwise they can't know.

It works at http level just fine.  Most likely you've defined 
proxy_set_header at server level as well, and this cleared 
values set on http level.  Note the following in wiki:

% proxy_set_header directives issued at higher levels are only 
% inherited when no proxy_set_header directives have been issued at 
% a given level

Maxim Dounin

More information about the nginx mailing list