DEV Community


How to write the original IP in the Apache log even via Cloudflare and Google Cloud Load Balancing (GCP LB)

nauleyco profile image Noriko Yamamoto ・1 min read

Follow the Cloudflare Document below.

Restoring original visitor IPs: Logging visitor IP addresses with mod_cloudflare

And then, Add and for CloudFlareRemoteIPTrustedProxy.

<IfModule cloudflare_module>
    CloudFlareRemoteIPHeader X-Forwarded-For
    CloudFlareRemoteIPTrustedProxy [your load balancer’s IP]

After restart httpd, You will see the original visitor IPs on your apache access logs.

FYI: GCP Document of External HTTP(S) Load Balancing Source IP addresses

Discussion (0)

Editor guide