Set FastCGI param if exists header

Tio Oscar tioscar at
Thu May 17 15:33:01 UTC 2012

Hi guys.

I have a one frontend server with nginx, and 5 backends with PHP-FPM, I do
a FastCGI pass and all works.

Now, I need add other fronted, balanced by hardware base balancer.

My problem is, i need track the remote IP address, is very very important,
in the fastcgi_params file, actualu REMOTE_ADDR param is set as

The balancer sendme a header called x_cluster_client_ip (yes, is ungly), i
recive this in nginx as $http_x_cluster_client_ip, but if I replace this
param and reload/restart nginx, before DNS change at the new balancer, i
don't get the x_cluster_client_ip value and i don't can't know the ip.

there is some form of define REMOTE_ADDR as $http_x_cluster_client_ip if
exists and $remote_addr else?

El Tio ~ Programador, hacker y filósofo
Twitter: @exos, @exos
Tels: [+54 11] 638-LINUX (54689) - [+54 9 11] 6799-4797

Version: 3.1
GCS/IT d-- s:++ a- C+++$ UBL+++$ P(-) L+++$ !E--- W+++$ !N !o K-? !w--- !O
!M-- V? PS+++@ !PE Y+(++) PGP++ !t--- !5 X++ R(+) tv--? b- DI D-- G e@ h>++
r+++(-) y+++>+++++
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nginx mailing list