Restoring original visitor ip with Cloudflare and Nginx

How to restore original visitor ip with Cloudflare and nginx

Mad Cat

5 minute read

Cat trying to catch a bird

Who doesn’t know Cloudflare yet? Cloudflare is one of the most used CDN (Content Delivery Network) providers in the world. Using a CDN in front of your tipical web server (For example nginx) provides a lot of advantages, like lower response times, increased security by hiding your real server ip address, and in the case of Cloudflare a lot of different features. On the other hand since Cloudflare acts as a reverse proxy some of your apps (Log analyzers, or any other kind of app that requires your visitors ip addresses) might stop working at all since your server won’t be able to get the real ip addresses of your visitors anymore.