Load balancing cannot fetch client IP

What is the name of the domain?

trusttopup.com

What is the issue you’re encountering

I’m using Cloudflare Load Balancing but I can’t seem to fetch client IP address via X-Forwarded-IP or CF-Connecting-IP request header.

What steps have you taken to resolve the issue?

I’ve added X-Forwarded-IP and CF-Connecting-IP request header to nginx access log, but it appears as ‘-’

Aug  3 06:34:41 10.192.0.165 ngx_frontend: 162.158.136.192 - - [03/Aug/2024:06:34:41 +0000] "GET / HTTP/1.1" 200 11338 "-" "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: a5be89cbfff8ab86)" "-" "-"

Here’s my log_format setting:

log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" "$http_cf_connecting_ip"';

This request is being made by one of Cloudflare crawler. I assume that the reason you see the CF-Connecting-IP as -. What if the request being made by the real user via the load balancer ?

Aug  3 06:34:41 10.192.0.165 ngx_frontend: 162.158.136.192 - - [03/Aug/2024:06:34:41 +0000] "GET / HTTP/1.1" 200 11338 "-" "Mozilla/5.0 (compatible; Cloudflare-Traffic-Manager/1.0; +https://www.cloudflare.com/traffic-manager/; pool-id: a5be89cbfff8ab86)" "-" "-"

This topic was automatically closed after 15 days. New replies are no longer allowed.