Preserving all original request headers through a proxy_pass ?
Rasmus Lerdorf
rasmus at lerdorf.com
Tue Dec 7 03:15:45 MSK 2010
On 12/6/10 3:46 PM, Eugaia wrote:
> Hi,
>
> On 07/12/2010 01:25, Rasmus Lerdorf wrote:
>> I'm probably being a bit lazy here, I have only skimmed the code, but is
>> there a way to bounce all original request headers through a proxy_pass
>> prefixed with X-Orig-* or something like that?
>>
>> One reason for wanting to do this is for proxy detection. Common
>> headers that are important to preserve are HTTP_X_FORWARDED, HTTP_VIA
>> and HTTP_PROXY_CONNECTION.
> Yes, you can use the proxy_set_header directive
> (http://wiki.nginx.org/HttpProxyModule#proxy_set_header).
>
> e.g.
>
> proxy_set_header NAME $value;
>
> You can obviously choose anything for NAME, including X-Orig-..., and
> the values can be static strings or generated using variables.
Well, the key word was "all" in the question. I know I can set
individual ones. I essentially want:
proxy_set_header X-Orig-* $http_*
Since I don't know what the full set might be.
-Rasmus
More information about the nginx
mailing list