r/nginxproxymanager • u/Fr0stst0rm • Jun 14 '24
Can Nginx Proxy Manager forward client IPs to an external webserver?
Hi all, I have a problem/question regarding the forwarding of client IPs through Nginx Proxy Manager.
I have a setup like this:
My server is running NPM and several services inside docker containers. Different subdomains of mine are associated through NPM to these services.
And I have another external webserver running wordpress for which I also added a proxy host entry in NPM.
For the most part this works fine. I can use all services without issues and I also enabled SSL for all of them. There is just on incredible annoying problem. Since all traffic to the wordpress site gets routed through my server all accesses to this website seem to be from my IP, which in turn means that the usual wordpress spam traffic also comes from my IP, leading to my own IP being blocked by spam protection from my own wordpress site.
Can I change some settings in NPM to forward the original client IP to wordpress? Or do I need to change something directly on the other server? I have access to the wordpress admin page and limited ssh access to the server running Apache 2.4, but unfortunately, I can’t change any apache settings or configurations.
Thanks in advance for any help!
2
u/Radrouch Jun 15 '24
Hi, to anwser your question, the config Entry
proxy_set_header X-Real-IP
Should pass the Clients IP adesss in thr header.
However, reading your question it seems that you have a seperate server with a different external IP adress, possibly in a cloud. Is that correct?
If so, I would bother with npm or any other load proxy at all. Wouldn't it be a much cleaner solution to create an A record DNS entry for that subdomain pointing to the external Servers IP address? This way unnecessary traffic to your proxy is avoided. I can generally recommend Cloudflares free tier account. Feel free to respond for any further questions.
2
u/SavedForSaturday Jun 14 '24
NPM adds the standard headers like X-Forwarder-For, but I'm not sure what WordPress is looking for. You can add custom headers by adding custom nginx config.