Cached version of the site when browsing from google search

I am using Cloudflare for my website. On the site, I have a handler set up as index.php, which is responsible also for geotargeting. When the site is accessed directly, everything works as expected; Cloudflare triggers the index.php handler, and the geolocation (country) of the user is correctly identified and handled.

However, I am facing a problem when users find my site through a Google search. When they click on the link from the search results, it seems that Cloudflare serves a cached version of the page. In this scenario, the index.php handler does not get triggered at all, which means that the geotargeting feature fails to work.

Does anyone have an idea of what could be causing this issue and how to resolve it? I need Cloudflare to always trigger the index.php to ensure geotargeting works consistently, regardless of how users arrive at the site. Thank you!


Cloudflare does not cache HTML by default. You need to check your Cloudflare configuration to see which of its products/features is being used to cache the HTML returned by your PHP file. In most cases, caching of HTML is activated by a Page Rule with a Cache Everything setting, a Cache Rule with a “Eligible for cache” setting, or by APO for WordPress. It may also be activated by Workers.

1 Like

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