CloudFlare and location for the users

Hi,
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.

2 Likes

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

4 Likes

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:
    - "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.

8 Likes

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.

8 Likes

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.

3 Likes

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

templates/cloudflare.template.yml

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.

2 Likes

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.

4 Likes

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.