In a self-hosting discussion about frequent nginx rate-limiting errors on a Discourse forum, ChrisBeach reports seeing many “too many requests” errors in the nginx logs, with client IPs showing as Docker’s internal IP (172.17.0.1) instead of real client IPs — potentially causing false rate-limit triggers. He shares his host-level nginx config, which includes forwarding headers like X-Real-IP and X-Forwarded-For, but suspects they may not be working. supermathie advises adding set_real_ip_from 172.17.0.1 inside the Discourse container’s nginx config to trust the Docker host IP and correctly interpret real client IPs. ChrisBeach questions why this isn’t included by default in Discourse’s stock nginx config, given Docker is the standard deployment method. supermathie clarifies that the recommended setup doesn’t involve an outer nginx instance, so the directive isn’t needed by default. Stephen suggests checking what IP Discourse itself reports for the visitor to confirm the issue. The thread concludes with ChrisBeach acknowledging the explanation.
Given that Docker is the standard deployment mechanism for Discourse, shouldn’t Discourse’s stock nginx config be set to include 172.17.0.1 as a set_real_ip_from directive out of the box?