S3 image bandwidth costs are getting annoying

I’m using Cloudflare on my Discourse site and it works fine. You basically route all your traffic through Cloudflare and tell it what to process or cache and that’s it. There are a few things to keep in mind though:

  1. Configure Cloudflare to NOT cache anything (set up exceptions using page rules, see below).
  2. Don’t let Cloudflare touch your Javascript - specifically, turn off Rocket Loader.
  3. I’m not sure about Brotli compression yet, I disabled it.
  4. Set up page rules to cache the avatar and upload directories as below (ignore rule #1, it’s site specific).

Cloudflare is currently caching a little over 3TB of data per month for me and it’s serving large graphics pretty fast.

If you’re more interested in a CDN I can also recommend https://www.belugacdn.com/ (I’m not affiliated with them). I use them on a large WordPress platform and performance is good, at a fraction of the cost of some other CDN platforms I looked at (those might be even more performant, but Beluga meets my needs).

17 Likes