So you’d like to use a CDN to speed up worldwide access to common assets on your Discourse forum?

Sign up with the CDN of your choice – we use and strongly recommend Fastly.

The configuration will look something like this:

What you’re looking for is three main settings:

  1. The origin address, which is the URL where your forum is currently located This is where the CDN will draw all its original content from on first request.

  2. The CNAME, which is the “friendly” name for your CDN that you’ll set up in your DNS, e.g.

  3. The CDN URL, which is the “unfriendly” name for where the cached CDN assets will be coming from via the CDN’s worldwide network of distributed servers. It will look like

You’ll need to edit your DNS to map the CNAME to the CDN URL, like so: IN CNAME

(Once you’ve edited the DNS, give it a little bit of time to propagate.)

The actual Discourse part of the setup is fairly simple. Uncomment the CDN line in your app.yml and update it with the CNAME you just set up in your DNS:

## the origin pull CDN address for this Discourse instance

(If you do not see this line in your app.yml, add it below the other DISCOURSE_ variables)

As with any other changes to your app.yml, you need to rebuild the container to reflect changes:

./launcher rebuild app

Once you’ve rebuilt, browse to your Discourse instance in the browser. View source and search for “cdn”. You’ll see that websites assets are now coming from your CDN:

This topic covers the more common scenario of static asset acceleration. See this topic for full site (both dyamic and static asset) CDN acceleration.