# Set FastCGI param if exists header

**URL:** <https://www.ruby-forum.com/t/set-fastcgi-param-if-exists-header/219830>\
**Category:** NGINX\
**Created:** [May 17, 2012, 5:34pm UTC](https://www.ruby-forum.com/t/set-fastcgi-param-if-exists-header/219830 "2012-05-17T17:34:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 17, 2012, 5:34pm UTC](https://www.ruby-forum.com/t/set-fastcgi-param-if-exists-header/219830/1 "2012-05-17T17:34:09Z")

</div>

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  
$remote\_addr.

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  
web: [http://blog.exodica.com.ar](http://blog.exodica.com.ar)  
Linked’in: [http://www.linkedin.com/in/ogentilezza](http://www.linkedin.com/in/ogentilezza)  
Twitter: @exos, Indeti.ca: @exos  
Tels: [+54 11] 638-LINUX (54689) - [+54 9 11] 6799-4797

-----BEGIN GEEK CODE BLOCK-----  
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+++\>+++++  
------END GEEK CODE BLOCK------

---

<div class="post-metadata">

**Author:** ![Tio\_O](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/b9bd4f/32.png) [@Tio\_O](https://www.ruby-forum.com/u/Tio_O)\
**Post date:** [May 17, 2012, 7:32pm UTC](https://www.ruby-forum.com/t/set-fastcgi-param-if-exists-header/219830/2 "2012-05-17T19:32:20Z")

</div>

Today May 17, 2012 at 12:33 Tio O. wrote:

> there is some form of define REMOTE\_ADDR as $http\_x\_cluster\_client\_ip if  
> exists and $remote\_addr else?

You can use realip module:  
[Module ngx\_http\_realip\_module](http://nginx.org/en/docs/http/ngx_http_realip_module.html)

–  
WNGS-RIPE
