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 location, 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, it will look like:


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

Still not finding what you need?

The CloudFlare team is here to help. 95% of questions can be answered using the search tool, but if you can’t find what you need, submit a support request.