Then, I opened my thread in the good topic. I would request that feature. 😉
Forwarding IPs on nginx proxy
-
Hey, can anyone tell me how can I forward the real IPs to NodeBB when running the forum behind nginx proxy? At the moment, every user has the local IP 127.0.0.1 displayed as the ''Recently Logged In IP''.
-
i have the same problem.. but i can't fix it...
maybe can @a_5mith help ? -
Verify you have
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
in your nginx file in sites-available, if you do, can you paste your nginx file for me to look at (you can remove the site url if you need to (but make it clear if you've used localhost or siteurl.com))
also make sure
use_port
is set tofalse
in your nodebbconfig.json
file. -
@a_5mith There... Maybe I should change
proxy_pass
?server { listen 80; server_name forum.domain.com; location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:4567/; proxy_redirect off; # Socket.IO Support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } }
-
@markkus Try it, if you get a 502, set your base_url to match, but without the port number.
-
Alright, got it working. So here is the list of things that I tweaked:
"base_url": "http://forum.domain.com"
in NodeBB config.use_port
is set tofalse
in NodeBB config.proxy_pass http://123.456.789.10:4567/;
in nginx config. (so that it matches the droplet's IP) -
@markkus Sounds good to me.
Hopefully this also solves @helltux's issue too.
Assuming he correctly substitutes his IP in proxy_pass and his domain name in base_url.