1 message in ru.sysoev.nginxIssue with proxy_set_header
FromSent OnAttachments
Rt IbmerJun 27, 2008 1:09 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Issue with proxy_set_headerActions...
From:Rt Ibmer (rtib@public.gmane.org)
Date:Jun 27, 2008 1:09:58 pm
List:ru.sysoev.nginx

I was having a problem where values I was setting using proxy_set_header in
higher directives were getting lost when trying to use proxy_set_header in lower
directives to add additional information.

Then I found this in the documentation, which explains the behavior I was
seeing:

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

The challenge I have, however, is that I really would like to be able to use
proxy_set_header at a lower level directive to **ADD** those headers to headers
I set in higher levels, rather than having this replace it. Is there a way to
do this or a directive to specify to override this behavior, or perhaps another
way to set the headers instead of using proxy_set_header?

The reason for this is that I use include files in my configuration to replicate
common settings between my SSL and non-SSL areas of the site, like this:

server { listen 80; server_name localhost; include main.conf; }

server { listen 443; server_name localhost;

proxy_set_header X-Protocol https;

... ssl key and other config settings here ...

include main.conf;

}

Then inside my main.conf I use proxy_set_header to set various headers,
proxy_pass and other common nginx configs.

So as you can see from the above, I want to have common headers set in main.conf
but still be able to add some custom headers (such as X-Protocol shown in the
sample above).

Is there a workaround or a better approach to this? Thank you!!