Forum: NGINX Inserting a Request header before proxying

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
B9340b8cfd6b4038536e58327ef648c9?d=identicon&s=25 unknown (Guest)
on 2008-10-13 08:47
(Received via mailing list)
I'd like to insert a custom HTTP header (eg: X-foobar) into a request
before doing a proxy_pass.

Is there any way to do this without changing the proxy module itself? I
read that there can be only one handler per request. Though my module
retruns NGX_DECLINED after doing its job, it doesn't seem to get
first and proxy_pass seems to get invoked first.
F850da95064ee4b7eae9caff255f6224?d=identicon&s=25 Almir Karic (Guest)
on 2008-10-13 09:06
(Received via mailing list)
B9340b8cfd6b4038536e58327ef648c9?d=identicon&s=25 Arvind Jayaprakash (Guest)
on 2008-10-13 11:23
(Received via mailing list)
How do I set dynamic values?
X-Foobar: <some_code_that_looks_at_request_and_generates_a_value>
5640e332954fc0006aea97a155ce0afd?d=identicon&s=25 Igor Sysoev (Guest)
on 2008-10-13 11:28
(Received via mailing list)
On Mon, Oct 13, 2008 at 02:43:04PM +0530, Arvind Jayaprakash wrote:

> How do I set dynamic values?
> X-Foobar: <some_code_that_looks_at_request_and_generates_a_value>

You module should define a variable. See map and geo modules as
Then you can use

   proxy_set_header  X-Foobar  $your_variable;
This topic is locked and can not be replied to.