Hey, admins, I keep wondering how to using cloudflare or proxy to protecting a discourse site?
AI-generated summary
To protect a self-hosted Discourse site using Cloudflare, Lee_Kris was advised by simon to add cloudflare.template.yml to the Discourse app.yml file. This is a required step as Cloudflare can cause issues with Discourse. Lee_Kris confirmed that adding the template and rebuilding the site worked, but asked about enabling additional templates (web.ssl.template.yml and web.letsencrypt.ssl.template.yml). codergautam shared that enabling the Cloudflare template and setting the Cloudflare SSL to full worked for them. However, it is unclear if codergautam enabled the additional templates. Lee_Kris is still seeking clarification on this.
Hi @Lee_Kris, welcome to the Discourse Meta community!
I am assuming that this is for a self-hosted site. If your site is hosted by Discourse, they have you convered - there shouldn’t be any need to use Cloudflare or a proxy to protect your site.
If you are self-hosting the site, this is probably a question where it would be worth searching for previous questions about this. Cloudflare in particular can cause some issues with Discourse and requires some extra steps to be taken. Here’s a good post about that: Using the CloudFlare template - #2 by Stephen.
Note that that post mentions the need to add cloudflare.template.yml to your Discourse app.yml file. There are some additional details about that here: Full site CDN acceleration for Discourse.
I’d recommend searching on Search results for 'cloudflare' - Discourse Meta to find more discussions about this issue. Feel free to reply to any of those topics, or get back to us here with any questions that you have.
Hi Simon:
Yes, I am a self-hosted site, I have noticed can add to app.yml and then rebuild
- “templates/cloudflare.template.yml”
More questions do I need to enable the below templates.yml to app.yml too or keep it disalbed?
- “templates/web.ssl.template.yml”
- “templates/web.letsencrypt.ssl.template.yml”
Also if I am using a proxy like Nginx with CF protected, can I change the default expose ports like below, then appending ssl get from CF by manually writing to nginx config file?
expose:
- “81:80”
- “443:443”
I just added that template and set my cloudflare SSL to full and enable the cloud and it worked
Are those templates enabled too?
- “templates/web.ssl.template.yml”
- “templates/web.letsencrypt.ssl.template.yml”