Join the web development community

Why to install mod_cloudflare at my server?

I configured Cloudflare to be used for my website. This is generally working. I do not see any difference but I hope the latency will be reduced by this. I do not know how to check this. However, now I found that there is a server packet called mod_cloudflare which can be installed on the server. Can anybody tell me what this is about?

Rafsan's picture

It helps to gain the original data to store in the server log

Vote the answer: 
No votes yet

In short, When mod_cloudflare enabled on your CloudFlare server the users original  IP address will appear in your server log. I think you are now thinking that it was meant to be anyway. Why do you need to use mod_cloudflare, an additional tool to do so? As you chose CloudFlare for your site, you know a little bit about it. If you were not using any CDN like CloudFlare then your assumption of appearing of your users IP on you server log was correct. What I am trying to tell is, without any CDN service enabled on your site, you will get user's IP on the server log. But if you have enabled CloudFlare like CDN, then you won't. The answer to this mystery lies beneath how CloudFlare works. Let me delve into the procedure with you. CloudFlare takes your visitors to your sites via its own network. Which secures your site from malicious attacks. It even stores static data like image, JavaScript, CSS which helps your site improve load time. So, CloudFlare works as a proxy of your site. This is why logs stored via CloudFlare are changes.


Generally, users access the site directly and as a result, their data is stored in your server log as they were.

Users (IP: x.x.x.x.x) > Server > Server Log (Stored IP of users: x.x.x.x)


In care of CloudFlare, users access the sites via it and the data servers get is from CloudFlare not directly from the users. And thus the manipulated data is stored in the server log.

User (IP: x.x.x.x) > CloudFlare (IP: y.y.y.y) > Server(Without mod) > Server Log (Stored IP of users: y.y.y.y)


Here mod_cloudflare comes at your help. It stores the original data from the users in the server log.

User (IP: x.x.x.x) > CloudFlare (IP: y.y.y.y) > Server(Without mod) > Server Log (Stored IP of users: x.x.x.x)