Uploads Subdomain For Cloudflare

Hi, as Cloudflare is likely to break Discourse according to several complaints, is there a way to set a separate subdomain for uploads and then front it with Cloudflare to avoid any problems, something like: https://uploads.xyz.com

I know that it’s possible by following the normal CDN setup and point the subdomain Cname to the bucket according to this: Enable a CDN for your Discourse and this Configure an S3 compatible object storage provider for uploads

But I need to skip S3 entirely and leverage Cloudflare caching directly infront of the uploads subdomain.

TLDR: Need to set a separate subdomain for the uploads folder without S3.

Thanks in advance.

3 Likes

Hey @dadberg

I don’t think we’ve ever said that Cloudflare breaks Discourse. What does cause problems from time-to-time is their ‘performance optimizations’. Discourse is already well optimized and occasionally these tweaks can cause havoc with an installation.

You don’t need a separate subdomain providing you do the following:

  • Install with the orange cloud turned off
  • Create a page rule to ‘disable performance’ for the entire subdomain
  • Create a page rule to cache your uploads path.
4 Likes

My bad I totally forgot about the page rule scenario for example https://community.com/uploads/*, that solved a lot of problems for me, thanks!

About the first step, may I know why installing with the orange cloud off? You mean to allow Let’s encrypt initial setup or something else?

It just doesn’t need to be there. I would always aim to get the install functional with the least complexity and then go from there.

Let’s encrypt used to be a showstopper, but that isn’t the case now.

Also be sure to rebuild with the CloudFlare template, otherwise you’re going to run into lots of other fun issues with everything appearing to originate from their network.

2 Likes

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