My current setup includes a pfSense firewall which port forwards public WAN traffic to a NAT internal IP.
Example:
- 104.12.134.12:80 (WAN IP) port forwards all traffic to 192.168.1.104:80
This is working as expected, traffic is forwarded on correctly. The issue I'm having is I see the local IP (i.e. pfSense router IP, in this case, 192.168.1.1) within Nginx logs.
I've searched and lots of articles suggest using real_ip module, and setting X-Forwarded-For header, but this doesn't work.
Notes:
- The IP of my router differs from the IPs I'm port forwarding (this is intentional).
- I don't own 104.12.134.12, this is just an example.
Best Answer
You should use the load balancing capability of pfsense to do this (as described here : https://www.howtoforge.com/how-to-use-pfsense-to-load-balance-your-web-servers) instead of a NATING Rule.
You can define only one loadbalancing pool with only one server in it.
Besides, it will allow you to add nginx servers later If you need it.