Restore Visitor's IP on Cpanel with Railgun installed

Hey Everyone,

We have installed Railgun on one of our new cPanel servers that doesn’t have mod_cloudflare installed as it is not available or supported anymore. We do have mod_remoteip installed.

When we are following the guide for setting railgun but we are stuck on the CloudFlareRemoteIPTrustedProxy step as it is not apart of the mod_remoteip module.

What would be the solution to get the server to see the correct IP of the site that are using Railgun?

The site we have that don’t use Railgun but use normal Cloudflare we are getting the correct IP.

Thank you for your suggestions.

Update to add Solution:

Update combined LogFormat entry

  • This can be done at WHM>>Service Configuration>>Apache Configuration>>Global Configuration :
    • LogFormat (combined)
      • Default is: %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
    • LogFormat (common)
      • Default is: %h %l %u %t \"%r\" %>s %b
  • Note that all you’re going to do is replace %h with %a so it should look like the following:
    • LogFormat (combined)

Code:

%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"
  • LogFormat (common)

Code:

%a %l %u %t \"%r\" %>s %b
  • Ensure you click the checkbox for the customized version then click Save at the bottom of the page
  • A prompt will appear telling you what’s been saved, confirm everything is as it should be
  • Select Rebuild Configuration and Restart Apache at the bottom of the page

Define trusted proxy addresses

  • This can be done through WHM>>Service Configuration>>Apache Configuration>>Include Editor → Pre Main Include
  • Select All Versions
    < IfModule mod_remoteip.c >
    RemoteIPInternalProxy (Your Server IP here)
    RemoteIPHeader CF-Connecting-IP
    RemoteIPTrustedProxy 173.245.48.0/20
    RemoteIPTrustedProxy 103.21.244.0/22
    RemoteIPTrustedProxy 103.22.200.0/22
    RemoteIPTrustedProxy 103.31.4.0/22
    RemoteIPTrustedProxy 141.101.64.0/18
    RemoteIPTrustedProxy 108.162.192.0/18
    RemoteIPTrustedProxy 190.93.240.0/20
    RemoteIPTrustedProxy 188.114.96.0/20
    RemoteIPTrustedProxy 197.234.240.0/22
    RemoteIPTrustedProxy 198.41.128.0/17
    RemoteIPTrustedProxy 162.158.0.0/15
    RemoteIPTrustedProxy 104.16.0.0/12
    RemoteIPTrustedProxy 172.64.0.0/13
    RemoteIPTrustedProxy 131.0.72.0/22
    RemoteIPTrustedProxy 2400:cb00::/32
    RemoteIPTrustedProxy 2606:4700::/32
    RemoteIPTrustedProxy 2803:f800::/32
    RemoteIPTrustedProxy 2405:b500::/32
    RemoteIPTrustedProxy 2405:8100::/32
    RemoteIPTrustedProxy 2a06:98c0::/29
    RemoteIPTrustedProxy 2c0f:f248::/32
    < /IfModule >

Is your cPanel running on Apache or Nginx?

I am not sure, but, do you have an option in cPanel for “Cloudflare” or not? - some hosting providers do not support or have not configured it even if they have a Cloudflare logo at cPanel for customers…

Also to note, some of them do not provide services like Memcached. Have you contacted your provider about it? And if you can use it, either Memcached and php-memcache and php-memcached packages for PHP (I assume Cloudlinux?).
Or you should contact them also about a possibility to install mod_cloudflare.

Moreover, have you added Cloudflare IPs to either .htaccess or nginx.conf file?

You need to add Cloudflare servers ip to set_real_ip_from and having the X-Forwarded-For header (or CF-Connecting-IP).

The server is running Apache. Everything is install configured and running except mod_cloudflare for getting the correct IP when Railgun is activated.

Cloudflare no longer supports mod_cloudflare and it has been removed from EasyApache.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.