2

My raw access log is now filled with CloudFlare IP addresses. Is there any way I can use a .htacess file or configure the server to log the user's actual IP address?

With PHP, CloudFlare creates these environment variables for our reference, but I can't find anything similar for raw access logs.

Unfortunately, as suggested in this Stack Overflow question, using mod_cloudflare.c for the following is not an option on a shared hosting server:

$_ENV["HTTP_CF_CONNECTING_IP"]
$_ENV["HTTP_X_FORWARDED_FOR"]
$_ENV["HTTP_CF_IPCOUNTRY"]

2 Answers 2

1

We have solutions for restoring original visitor IP with CloudFlare in our knowledge base.

5
  • Bad answer with an inaccessible link
    – Novocaine
    Sep 4, 2015 at 9:35
  • That link loads fine for me. In addition, the server logs can only be addressed by one of the solutions in the link. Try again. Sep 5, 2015 at 3:37
  • Actually see the issue(there is a weird redirect on that URL). The solutions are outlined at: support.cloudflare.com/hc/en-us/sections/… Sep 5, 2015 at 3:40
  • Yeah, link didn't work for me either, but I've edited the post with your updated one, thanks Damon.
    – Simon East
    Sep 10, 2015 at 7:00
  • The OP already tried mod_cloudflare but can't use it on shared hosting. Unfortunately this doesn't actually answer the question of how to get these in that case. Sep 10, 2015 at 8:18
1

on a shared hosting server

Unfortunately, this is not possible on a shared server, since you won't have access to the server config.

To install mod_remoteip (or mod_clouldflare) and/or to change the access LogFormat you need access to the main server config and to be able to restart the Apache webserver.

Although with Cloudflare CDN in front of your application server, your server access logs are arguably less useful anyway, since the majority of requests are probably now served by Cloudflare.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.