How do I configure mod_cloudflare to restore visitor IPs when using Railgun?

When using Railgun (or other reverse proxy software, such as Varnish), user's requests will come from your Railgun server instead of Cloudflare. Because request's are not coming directly from Cloudflare, mod_cloudflare will not restore visitor IP addresses by default.

To fix this, open up your Apache configuration (this can typically be found in /etc/apache2/apache2.conf, /etc/httpd/httpd.conf, /usr/local/apache/conf/httpd.conf or another location depending on configuration, if you're unsure ask your hosting provider) and at the very end add:

CloudflareRemoteIPTrustedProxy railgun_address

So, if your Railgun server is located at 127.0.0.1, it will look like:

CloudflareRemoteIPTrustedProxy 127.0.0.1

If you have more than one server to add to the trusted proxy list, you can add them at the end:

CloudflareRemoteIPTrustedProxy 127.0.0.1 127.0.0.2
Not finding what you need?

95% of questions can be answered using the search tool. This is the quickest way to get a response.

Powered by Zendesk