Project

General

Profile

Restoring original visitor IPs Logging visitor IP addresses with mod extforward » History » Revision 3

Revision 2 (hasonm, 2020-06-11 13:38) → Revision 3/5 (hasonm, 2020-06-11 13:43)

h1. Restoring original visitor IPs, IPs Logging visitor IP addresses with mod extforward 

 This tutorial is for Cloudflare but also applies to other reverse proxy/ load balancer. 

 * Add "mod_extforward" to the bottom of your server.modules block in modules.conf 
 * Right below the server.modules block, add 

 <pre> 
 ##Cloudflare start (https://www.cloudflare.com/ips-v4) 
 extforward.forwarder = ( 
	 "173.245.48.0/20" => "trust", 
	 "103.21.244.0/22" => "trust", 
	 "103.22.200.0/22" => "trust", 
	 "103.31.4.0/22" => "trust", 
	 "141.101.64.0/18" => "trust", 
	 "108.162.192.0/18" => "trust", 
	 "190.93.240.0/20" => "trust", 
	 "188.114.96.0/20" => "trust", 
	 "197.234.240.0/22" => "trust", 
	 "198.41.128.0/17" => "trust", 
	 "162.158.0.0/15" => "trust", 
	 "104.16.0.0/12" => "trust", 
	 "172.64.0.0/13" => "trust", 
	 "131.0.72.0/22" => "trust", 
 ) 
 extforward.headers = ("CF-Connecting-IP") 
 ##Cloudflare end 
 </pre> 

 * Check if your configuration file is ok by doing: 
 lighttpd -t -f /etc/lighttpd/lighttpd.conf 
 lighttpd -t -f /etc/lighttpd/modules.conf 

 * Restart lighttpd