Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

Restoring original visitor IP for cPanel Apache under CloudFlare

Written by: on 20 July 2021 05:08 PM 20 July 2021 05:08 PM

Please note that installing mod_cloudflare is not working anymore at least since January 2021.

Instead you need tp install mod_remoteip.

It can be done via:

1. Yum installer with command: yum install ea-apache24-mod_remoteip

or

2. Using WHM -> EasyApache 4 -> Customize -> Apache Modules, search for remoteip.

After install remoteip module you need to find the file:

/etc/apache2/conf.modules.d/NNN_mod_remoteip.conf
where NNN is a sequence of digits, it can be different or different hosts.

Note: on CentOS 6 it can be found at /etc/httpd/ directory.

Edit the file and add the following content to it's bottom:

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


If you read this article in 2199 year please double check actual CF ip addresses at this URL: https://www.cloudflare.com/ips/

Then restart Apache.




(0 vote(s))
Helpful
Not helpful