Custom log format for use with CloudFlare

Discussion in 'Feedback/Feature Requests' started by gboudreau, Oct 4, 2010.

  1. gboudreau

    gboudreau Well-Known Member


    I enabled CloudFlare on a couple of my websites a couple of days ago, and now faced the problem where the real IP addresses of my visitor is not in my logs anymore.

    CloudFlare sends the real IP of clients using a custom HTTP header, but since I'm not using the Enterprise version of LS, I can't use custom logs, and thus can't use "%{Foobar}i" instead of the standard %h.

    Just wanted to share that I now lost my visitor's IP addresses because I can't customize the log format.
    Would be happy if that feature (or any other way to make LS CloudFlare-compatible) would be avail. in the standard version.

  2. NiteWave

    NiteWave Administrator

  3. gboudreau

    gboudreau Well-Known Member

    Sadly, no.

    Not sure why they don't use the standard X-Forwarded-For...
    Will ask them if maybe they could add an option to allow me to choose between both in my account settings... Would indeed fix the problem.

  4. gboudreau

    gboudreau Well-Known Member

    Apparently, they already do fill that header!
    It was not documented, thus why I didn't think it was, but enabling this option did give me the correct IP in my logs!

    Big thanks for the pointer.

    Good day.
  5. NiteWave

    NiteWave Administrator

    Apparently, they already do fill that header!
    can you check if HTTP_CF_CONNECTING_IP and X-Forwarded-For has same value?
  6. gboudreau

    gboudreau Well-Known Member

  7. NiteWave

    NiteWave Administrator

    tested with the URL, not exact same, in my case:

    HTTP-X-Forwarded-For: xx.xx.xx.xx,yy.yy.yy.yy
    HTTP-CF-Connecting-IP: yy.yy.yy.yy

    xx.xx.xx.xx is my IP, yy.yy.yy.yy is my ISP's http proxy IP.
  8. gboudreau

    gboudreau Well-Known Member

    Thanks. I'll see with them if that's supposed to be like this. I'd think HTTP-CF-Connecting-IP should be the client IP, not the proxy IP.
  9. jp0p

    jp0p New Member

    I'm also going to give a try. If I enable the "Use Client IP in Header" feature and I have sites that do not go through a proxy, will the original header information be populated correctly? Or does it only use the x-forwarded-for header exclusively for all sites after it is enabled?

    Many thanks!
  10. gboudreau

    gboudreau Well-Known Member

    If there is no HTTP-X-Forwarded-For header, the client IP is logged, as it should.
    I stopped using CloudFlare a while ago, and never disabled that option, and the correct IP addresses are logged for all requests.
  11. jp0p

    jp0p New Member

    Thanks for your reply gboudreau!

Share This Page