Nginx logs showing client ip of ::1

Good evening, I apologize if this has been answered before / is mislabeled but I’ve recently setup an nginx webserver behind cloudflare and I use argo tunnel rather than port forwarding. Recently in my nginx log files, the client IP is logged as ::1 (for all clients) and I can’t seem to fix this for the life of me.

For context, I use authenticated origin pulls, and argo / argo tunnel and do not have access to True-Client-IP as I use the free plan. My nginx build does not have http_realip_module. Would anyone know a suitable workaround? Thanks!

It is expected for requests to come from ::1 if you’re using the Argo tunnels as all requests are coming through the Argo service you have installed on your server.
The recommended way for the correct ips to be shown in your logs again is to use the realip module, as explained on https://support.cloudflare.com/hc/en-us/articles/200170786-Restoring-original-visitor-IPs-Logging-visitor-IP-addresses-with-mod-cloudflare-

2 Likes

I appreciate you getting back to me so quickly!

I run openresty and thus have recompiled using the appropriate nginx module and have done part 1 of the link you’ve provided (though I was unable to figure out part 2 as I didn’t understand the " in the log_format directive.". It seems to compile fine but the log files still show ::1, is this expected still?

The only thing left to do is to modify the log_format to include $http_cf_connecting_ip and $http_x_forwarded_for, you can do that in your nginx.conf file which usually is in your nginx directory.

1 Like

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