# Variable dobts:- Do I need to hard code values ($host, $rmote\_addr , $proxy\_add\_x\_forwarded)

**URL:** <https://www.ruby-forum.com/t/variable-dobts-do-i-need-to-hard-code-values-host-rmote-addr-proxy-add-x-forwarded/199797>\
**Category:** NGINX\
**Created:** [November 29, 2010, 2:04pm UTC](https://www.ruby-forum.com/t/variable-dobts-do-i-need-to-hard-code-values-host-rmote-addr-proxy-add-x-forwarded/199797 "2010-11-29T14:04:02Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/77aa72/32.png) [@Dobai-Pataky\_BSSSSl](https://www.ruby-forum.com/u/Dobai-Pataky_BSSSSl)\
**Post date:** [November 29, 2010, 2:04pm UTC](https://www.ruby-forum.com/t/variable-dobts-do-i-need-to-hard-code-values-host-rmote-addr-proxy-add-x-forwarded/199797/1 "2010-11-29T14:04:02Z")

</div>

Hi  
I am trying to configure nginx for reverse proxy,my intention is to  
have load balancing, On 192.168.20.59(CentOS) I have nginx installed. I  
have two machines(192.168.20.59 and 192.168.20.208) running IIS.

My Test environment is as shown in the map

# | ============= |---- [rac1.mydomain.com](http://rac1.mydomain.com) | LAN | | 192.168.20.59 ============= |---- [rac2.mydomain.com](http://rac2.mydomain.com) | | 192.168.20.208 | | | |eth0 → 192.168.20.34 ------/ |-lb0==| / | |eth1 → 192.168.20.44 ----/ | | eth1=virtual IP address | |

# |LAN Connection |

I am referening book "Nginx HTTP server ", Chapter 7 + other related  
google search results. I have doubt in the variable setting, do we need  
to hard code the value of does the program take it from any other  
parameters.  
My doubts are how I am getting values for $host, $rmote\_addr ,  
$proxy\_add\_x\_forwarded\_for(part of configuration files I have cut and  
pasted); Do I need to give the real IP address itself instead of the  
varibales ($host, $rmote\_addr , $proxy\_add\_x\_forwarded) in the  
configuration file

## PROXY - Web

location / {  
proxy\_pass [http://127.0.0.1:80](http://127.0.0.1:80);  
#proxy\_pass [http://192.168.20.34:80](http://192.168.20.34:80);  
proxy\_cache cache;  
proxy\_cache\_valid 200 24h;  
proxy\_cache\_use\_stale error timeout invalid\_header updating http\_500  
http\_502 http\_503 http\_504;  
proxy\_ignore\_headersExpires Cache-Control;

```
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

```

}  
##############  
Please advice me  
Thanks  
Joseph John
