Visitor IPs are not logged for websites behind CloudFlare on Plesk

A common problem for websites hosted on a Plesk server and proxied via CloudFlare is that visitor IPs do not get logged in the site access log – instead you see CloudFlare IP addresses in the logs.

Plesk has documented this issue and solutions for it in its official documentation:

https://support.plesk.com/hc/en-us/articles/12377061126807-Incorrect-IP-addresses-are-logged-in-the-access-logs-of-Plesk-domains-behind-a-Cloudflare-CDN-proxy-or-Google-Cloud-Load-Balancing

While there are numerous of manual solutions mentioned for this problem, I recommend you to check the automated script solution under the section “Server-wide solution with Nginx enabled” and add this script to scheduled tasks of your server. Executing it once a day will be enough as CloudFlare does not update their IP pools often.

BASH Script for auto-updating CloudFlare IPs in the Plesk NGINX configuration:

https://github.com/plesk/kb-scripts/blob/master/cf-nginx-ip-passthrough/cf.sh

Leave a Comment on Visitor IPs are not logged for websites behind CloudFlare on Plesk
About the author
I'm a full-stack WordPress developer with a 10+ years of solid experience in the core web development languages, development processes / techniques, web security, Linux server management and with pretty good understanding about proper semantics, UX/UI, technical SEO, good design and basic knowledge of company leadership. On top of that - a distant 5+ years experience as a computer and electronics repair technician which often enables me to understand also how the things work at the hardware level.
Your feedback matters!…
I hope you found this article helpful. Feel free to add some comments - your feedback is very important to me, as it drives my motivation and helps me to improve the content.