I'm running SMF 2.0.15 in Docker behind an nginx proxy, which adds X-Forwarded-For and X-Real-Ip headers, however SMF shows all users as logged in from the docker proxy IP (172.16.x.x.)
How do I get it to recognize the X-Forwarded-For or X-Real-Ip headers and use those for users instead?
I'm using a modified version of this repo: https://github.com/vortexau/SMF-Docker which creates an Apache 2 instance where the default website is pointing at /var/www/html inside the container.
On the outside, nginx does a reverse proxy to the container and adds these headers.
This might be hepful https://support.cloudflare.com/hc/en-us/articles/200170706-How-do-I-restore-original-visitor-IP-with-Nginx-
You can also add to your settings.php a php code that checks if those headers are set then overwrite the php ip address.
This seems to have worked perfectly with only minor changes on the apache side. (For anyone else reading this, again, nginx is on the outside acting as a reverse proxy, apache is on the inside of the Docker container, and runs SMF)
1. enable remoteip by linking mods-available/remoteip to mods-enabled.
2. add RemoteIPHeader X-Real-IP to httpd.conf