Project

General

Profile

Actions

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

« Previous | Revision 4/5 (diff) | Next »
gstrauss, 2020-06-11 19:54


Restoring original visitor 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
##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
  • Check if your configuration file is ok by doing:
    lighttpd -tt -f /etc/lighttpd/lighttpd.conf
  • Restart lighttpd

Updated by gstrauss almost 4 years ago · 4 revisions