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
No difference - https://developers.cloudflare.com/fundamentals/get-started/reference/http-request-headers/#x-real-ip
HTTP request headers · Cloudflare Fundamentals docs
Cloudflare passes all HTTP request headers to your origin web server and adds additional headers as specified below.
Is there a preference on which to use? It seems like
CF-Connecting-IP
is more standardFunctionally they're the same -
CF-Connecting-IP
is the usual go-to but there's no differenceOkay thanks :)
And can they ever be empty, or is that just not how it works?
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
Gotcha