CloudFlare and location for the users

I see that when the users see logged in devices, Discourse shows the edge CloudFlare edge server location.
I have made so that the whole forum is behind CloudFlare, is there an option to use the CloudFlare geo header, after all the server will have it received.


Welcome @kaziqta! Unfortunately we don’t recommend running all your traffic through CloudFlare, as it can cause issues with Discourse sites not working properly.


Yes, there’s a template you can add to your app.yml which will pass the client IP that Cloudflare forwards into Discourse. Add cloudflare.template.yml to the templates block as follows:

    - "templates/cloudflare.template.yml"

And then rebuild.

I don’t think this is true at all, providing a rule is created to “disable performance” for the Discourse URL so that no extra optimisations or minification interferes with the payload and Brotli is disabled at a domain level there aren’t any real issues.

It does add unnecessary hops from client to server, which can delay requests by a small amount, but otherwise it works fine.


I have translated a lot of strings, btw, will that be lost on rebuild?

Are you contributing to Discourse on Transifex?

1 Like

There is one, and only one, legit case for running everything through CloudFlare – when your site is at high risk of DDoS and you can’t risk exposing the source IP of your site. There are some other topics here on that, the danger is that the IP can be revealed through some obscure output somewhere so you have to be very sure there are no IP leaks or all is lost.


For people who can’t afford a separate CDN it’s also not a bad way to offload uploads and avatars, but yes otherwise the complexity and disadvantages outweigh any benefits.


Directly in Discourse, Bulgarian translations are just… I already translated “disqus” :smiley: but I just want to know if I rebuild if the internal translations are lost

RE: did it :slight_smile: I ran the script that is in the


Added the output to my nginx config, all good now! thank you! :slight_smile:

1 Like

Heads up Stefan: if you ran the script itself it’ll be overwritten the next time your update Discourse. Be sure to include the template in your app.yml to make sure it is persistent.

If you look near the top of your existing app.yml in /var/discourse/containers/app.yml you’ll see a number of templates. Add Cloudflare the Cloudflare template to that list. Note that YAML is incredible whitespace sensitive, so ensure everything continues to line up.


Sure, added already.

Just want to know if rebuild deletes the local translations

1 Like

If you did them in the UX through the /admin/customize/text interface, you’re safe.


Perfect, thank you for the information

1 Like

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