A user is trying to get real IP addresses to show up in Discourse when using Cloudflare, but the remote_addr is not being set correctly despite having the proper Cloudflare configuration in discourse.conf. bitwelder confirms they are using the Cloudflare template and that the CF-Connecting-IP header contains the correct IP, but the issue stems from Docker IPs being used instead. pfaffman suggests checking for a reverse proxy and adding its IP to set_real_ip_from, while Stephen questions if the standard install was followed. bitwelder resolves the issue by identifying that Immunify360 on their VPS was acting as a proxy, and temporarily fixing it by adding the Docker IP to the configuration.
I have been trying to get real ips to show up in Discourse without much success. I have add the cloudflare yml to my setup and have validated the discourse.conf in the container has the correct lines:
I have also validated that $http_cf_connecting_ip has the correct IP in the logs but for some reason $remote_addr is not being set properly. Has anyone else hit this?
Thanks for the response! I am using the cloudflare template. After further digging it appears that it is not working because all remote_addr coming into nginx are Docker addresses. I am trying to diagnose why this is.
Are you also using a local reverse proxy server? If so, you’ll need to add that address to your set_real_ip config (and maybe the reverse proxy will handle the cloudflare stuff?)
Thank you both for the help! It ended up that Immunify360 on our VPS was injecting itself as a proxy prior to the container. Adding the Docker IP to the set_real_ip_from temporarily fixed the issue while I look into disabling Immunify.