Welcome! Log In Create A New Profile

Advanced

incoming X-Forwarded-For in conditional evaulation

Andrey Semyonov
October 27, 2010 06:44AM
Hi.

I've set up nginx as a front-end for apache with mod_rpaf.

My config (parts that are meaningful for this thread) is:
--------------------------------------------------------------------
http {
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $remote_addr;

server {
listen 80;
server_name ~^www\.domain\.com$;
location / {
proxy_pass http://127.0.0.1:80;
}
}
}
--------------------------------------------------------------------
This works fine. But now I need to bypass original incoming
X-Forwarded-For without change if it equals to '1.2.3.4' or '2.3.4.5'.

I've tried to filter like this:
if ($http_X-Forwarded-For = "1.2.3.4") { proxy_set_header
X-Forwarded-For "1.2.3.4"; }
but that didn't work. How do I evaluate incoming custom HTTP headers
(those not having their own dedicated variables like $content_length
and others) in config file?

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

incoming X-Forwarded-For in conditional evaulation

Andrey Semyonov October 27, 2010 06:44AM

Re: incoming X-Forwarded-For in conditional evaulation

Francis Daly October 27, 2010 07:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 156
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready