We encountered some problems using APO with Geolocation plugins. Our setup is like this:
- Wordpress with Geolocation IP Detection plugin, we are using some shortcodes approach to show/hide contact information depeding on visitor location
- Geolocation IP detection plugin gets visitor information from CF headers
- Kinsta hosting, they created individual, separate cache buckets for chosen countries (US, CA, AU, DE, GB)
- Cloudflare, with Geolocation headers enabled
If we use the setup without APO or in developer mode, everything works as expected. But, I we enable the APO, purge the CF cache, then the first country that browses the cache, populates it worldwide, so if second visitor from another country browses the webpage, he sees the content meant for different country. Sometimes a mixed content, depends on time between browsing.
If a browser refresh or revisit is made, the right content is shown to this individual visitor.
I’ve tested and confirmed the problematic behaviour with Hoxx VPN, Tunnel Bear, Geotargetly.
To my very laic understanding, this is due to APO proactively pushing and replicating the content to CF datacenters (as opposed to pull), but the content is obviously ends up being same for all the countries.
Is this a bug or expected behavior, is this something that can and will be fixed or shall we stick to “Cache Everything”?
Thanks and best regards,