Security tab shows me a different location due to Cloudflare

Hello guys,
Why it shows my location as the UK while I am in India? Am I missing something in the settings?

Are you using some kind of VPN? I think the Location is based on the IP that is used for the particular login.

1 Like

No I am not using any VPN service. But I am using cloudflare for my site. Is that a problem?

I don’t know if Cloudflare is affecting the lookup. Discourse is using MaxMind, so you can try for yourself by entering your IP address at

1 Like

Maxmind shows my exact location. Seems like Cloudflare datacenters issue to me, but not sure.

So Your site is behind cloudflare?

Yes…for almost 1 year without any problem.

Did You include the cloudflare template in your yml file?


I don’t think it has anything to do with Cloudflare, but just to be sure, can you go to your profile and look at the list of last used devices? The locations in that list have a tooltip with the IP address. Is it showing the correct IP address?

My guess is that the MaxMind DB with IP addresses is out of date. You could try rebuilding the container.

@nbianca Correct me if I’m wrong, but I believe there is no background job for regularly updating that database and I’m not sure if Discourse picks up the changes when the maxminddb:get rake task is executed without a restart.


This is what’s shown in my profile. Why is it showing Singapore? :cold_face:


When I click on the log out all, my session was logged out and I have to login again.
Tried rebuilding the app, then logged out and log in again, but still the same.

No, I haven’t included the cloudflare template in yml file.

Did the ip address that Discourse reports match your ip address? It is likely that Discourse is seeing the address of the cloudflare data center that is requesting the data. See if your logs are correctly logging up address or only those of cloudflare data centers.



This could be a problem with MaxMindDb (old or not precise) or Cloudflare.

To rule out Cloudflare, can you please check if the IP shown in the admin panel (Admin > Users > your username) under “Last IP Address” matches your real IP? If yes, it might be a problem with MaxMindDb being too old.

Yes, that is true. There is no background job for regularly updating the database or hot-reloading the MaxMindDb.


No, my IP is not matching the one shown in discourse. So it’s more like a discourse problem, right?

No, it’s a configuration problem.

You really should follow the steps in Full site CDN acceleration for Discourse in order to get a working Cloudflare setup.


I didn’t get most of the part mentioned in that link. Can you tell me what exactly I have to do get maximum out of my free Cloudflare account? What changes do I have to make?

Follow the link already provided above.