Stale CF-Connecting-IP header

Hi All,

I am having a problem whereas the CF-Connecting-IP header seems to be cached somewhere. For example, if I restart my router and get assigned a new public IP from my ISP, CF will still send my old public IP in the header. But, after about 10 minutes or so, the correct IP is reported.

Additionally, if I open one of my websites (which had not been opened previously) in a different browser immediately after the IP change, then the correct new IP is sent in CF-Connecting-IP header.

This is a problem for us, as we use IP matching between our frontend and some external services.

Any ideas if this is normal behavior, and is there a way to reduce or remove this delay?

This is unlikely to be an issue on Cloudflare*). Have you completely ruled out that you might be caching the value somewhere in your setup?

Can you provide a link where you are echoing the value?

*) That header is stateless and its value is specific to the connection in question. If your description was accurate, it would mean connections leak data into each other and that would indicate a broader issue on Cloudflare and - I assume - would/should have been already noticed.

I’ve tried all I could think of. Apache, Nginx, with or without reverse proxies… It’s also happening with a client’s website, which is hosted on AWS.

On closer inspection, it actually seems to affect only Chrome. With Firefox, or even cURL, the IP refreshes instantly.

And to make matters even more confusing, I added the CF-Connecting-IP header to my nginx access logs, this is reported correctly!

So it appears Chrome is caching some headers? Other ones such as HTTP-CF-Ray do change with each request…

Here is my test script, it’s just print_r($_SERVER); in PHP:

That header cannot be affected by Chrome - or browsers in general - as it is purely something the proxy and the origin agree on.

Your link seems to suggest you have an additional proxy between your origin and Cloudflare. I would suggest you check there, as I believe that place is most likely to persist that value for whatever reason.

Unfortunately I cant currently try to reproduce it, as I am not on a connection where I can change the IP address, but I might get later to it, however I firmly believe this will be a local issue :slight_smile:

That’s what I thought too, but then it does not explain why I get the correct IP with Firefox and cURL… Anyway, will keep experimenting!

Maybe something in the request headers that only Chrome is sending and that inflluences what your internal proxy caches.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.