Cloudflare Show Real IP Address on CentOS Plesk Server

Cloudflare is a popular Content Delivery Network (CDN) that can greatly improve website performance and security. When using Cloudflare CDN, the server will report Cloudflare server IP as the visitor IP address. This is because when a visitor visit your website, they are visiting cloudflare server. Cloudflare server will fetch web page from your server, serve it to the visitor. So all access to your server is coming from Cloudflare server, not the real visitor. Cloudflare forward real visitor IP addresses in an HTTP Header “CF-Connecting-IP”. To make Apache show real visitor IP addresses, you can use the Apache module remoteip.

Enable Apache module remoteip in Plesk

To Enable remoteip module in Plesk login to Plesk as user admin or root. Go to

Plesk Admin > Tools & Settings

Plesk Apache Settings

Under “General Settings”, click on “Apache Web Server”

On the next page, you will see all available Apache modules. To activate remoteip module, select the checkbox left side of remoteip and click the “OK” button.

Configure remoteip module

Create file

vi /etc/httpd/conf.d/remoteip.conf

In the file, Add

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

Save and exit the file. Restart Apache web server.

systemctl restart httpd

Now Apache will see the real IP address of visitors coming from Cloudflare CDN.

Back to Plesk

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *