Cloudflare Restoring Visitor IP in Ubuntu Plesk Apache Server

When using Cloudflare CDN, visitors come to the Cloudflare server and Cloudflare fetches pages from your server and sent to the visitor. Your server only sees Cloudflare’s IP address. To fix this, we can use the Apache module remoteip.

On Ubuntu (or Debian) server running Plesk control panel with Apache webserver (no Nginx) do the following to restore real visitor IP address when using Cloudflare CDN.

Enable mod_remoteip

Create file

Add the following to the file

Restart Apache

Now the site will show real visitor IP. You can verify with phpinfo() page, search for RMOTE_ADDR to see real visitor IP.

Leave a Reply

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