Skip to content

Instantly share code, notes, and snippets.

@vovanmix
Last active April 16, 2016 00:10
Show Gist options
  • Select an option

  • Save vovanmix/fdfe9d53201f4ae809e094e4aca33950 to your computer and use it in GitHub Desktop.

Select an option

Save vovanmix/fdfe9d53201f4ae809e094e4aca33950 to your computer and use it in GitHub Desktop.
  1. install cloudflare_module
https://support.cloudflare.com/hc/en-us/articles/203656534-How-do-I-restore-original-visitor-IP-with-Apache-2-4-

mirght need to change sudo yum install httpd-devel libtool git with sudo yum install httpd24-devel libtool git

  1. put the config file to /etc/httpd/conf.d/cloudflare.conf
CloudFlareRemoteIPHeader X-Forwarded-For

CloudFlareRemoteIPTrustedProxy 10.0.0.0/8

RemoteIPHeader CF-Connecting-IP

  1. update /etc/httpd/conf/httpd.conf
LogFormat "%{X-Forwarded-For}i %{CF-Connecting-IP}i %v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
  1. add to /etc/httpd/conf.d/ssl.conf
LogFormat "%{X-Forwarded-For}i %{CF-Connecting-IP}i %v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

before

TransferLog logs/ssl_access_log
  1. restart apache
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment