Cloudflare APO + Geolocation plugin Situation

Hello to all,

I hope you may be able to share some insight and help me resolve my situation:

We have a Wordpress website and we use a Geolocation plugin to display the visitors country via shortcodes. We use Cloudflare + APO caching.

However it seems that Cloudflare caches the nearest server (even after clearing all cache) and displays different location to the visitor and not its real IP location. Only after couple of pages it detects the right IP and displays it.

I noticed previous threads regarding this issue but with no information how to resolve this.

My question is - is there something we can do about this since I am not actually able to use a geolocation plugin unless I deactivate Cloudflare - if I temporarily disable cache everything works great.
Is it possible to maybe exclude the plugin or any other trick via the dashboard that may help us?

I hope to hear back from those who might have a clue. Thank you so much for your time!

Make sure you restore the original visitor IP address. Then your geolocation plug-in should work correctly.

Albert, thank you so much for the quick reply!

I saw in the article it says ’ Cloudflare no longer updates and supports *mod_cloudflare ’ does this mean if I try to implement it won’t work?

I am trying to add a page rule to our main domain where there is an option I enabled named “IP Geolocation Header”. I truly do not know what is actually this doing.

As mentioned in the article, you should use mod_remoteip instead.

This adds additional HTTP headers to the request containing geolocation information.

Thank you so much. My bad wrongly interpreting it.

P.S. The plugin has an option to send requests via AJAX.

Then I went to CF dashboard and added this rule:*

Cache Level: Bypass, IP Geolocation Header: On

I tested via NordVPN many locations and it seems to work. I don’t know if this rule above makes sense but for some reason it works at the moment.

Can we know which geolocation plug-in you are using? Does it support configurable client IP variable?

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