If I’m not wrong, the main difference between these two is: x-forwarded-for
will include the client IP address and all the proxy IP addresses that the traffic passes through; cf-connecting-ip
does not - it only captures the client IP address seen by Cloudflare network.
If you use Cloudflare and you would like to see the original visitor IP address on your server logs, you should configure your web server to read the cf-connecting-ip
header - because your web server will see Cloudflare IP address by default.
I don’t think this is possible. The usage of the header is only known to the web server administrator but not the client/visitor.