#Apache: Log IP correctly when using a CDN
(assumes Ubuntu)
##Edit Config
in /etc/apache2/apache2.conf
after HostnameLookups Off
add
RemoteIPHeader X-Forwarded-For
RemoteIPInternalProxy 127.0.0.1/8
in the LogFormat line,
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
change %h to %a
##Enable Module
Then enable mod_remoteip:
a2enmod remoteip
restart Apache
service apache2 restart
IP of remote device should now be logged correctly.