What is the difference between `CF-Connecting-IP` and `X-Real-IP` and can they ever be empty?

Using it for a simple rate-limiting purpose and was wondering :)
6 Replies
kian
kian14mo ago
HTTP request headers · Cloudflare Fundamentals docs
Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below.
Mozzy
Mozzy14mo ago
Is there a preference on which to use? It seems like CF-Connecting-IP is more standard
kian
kian14mo ago
Functionally they're the same - CF-Connecting-IP is the usual go-to but there's no difference
Mozzy
Mozzy14mo ago
Okay thanks :) And can they ever be empty, or is that just not how it works?
Peps
Peps14mo ago
If the request came from a browser/client, it should never be empty as far as I'm aware there are some type of requests coming from Cloudflare that don't have that header, such as health checks, early hints and some more I can't immediately remember
Mozzy
Mozzy14mo ago
Gotcha