Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

Do you want to configure StackPath CDN for your Discourse forum but couldn’t find any comprehensive guide? I had the same problem, so I created this step-by-step guide.

Step 1: Create a StackPath Account

As I mentioned in my introduction, the first step to configuring StackPath CDN for your Discourse forum is to create a StackPath account. Then, create your StackPath “Site”.

Follow the steps below to complete these tasks:

  1. Open stackpath.com and create an account. To create an account, on the top right of the stackpath.com homepage, click Get Started.
The fastest way to create an account with StackPath is to scroll down the Get Started page and sign in with either your GitHub, Google or Facebook accounts.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. Once you have created a StackPath account, control.stackpath.com. Then, on the top right of your StackPath Dashboard, click Create Site.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. On the Create a Site // Select an Integration page, click Select Full Site.
  1. On the Create a Site // Full Site Integration page, enter the URL of your Discourse forum. In this example, I am using the URL of Itechguides Community forum, community.itechguides.com.
  2. After entering the URL, check the box beside the Content Delivery Network (CDN) option, scroll down and click Add to subscription.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. When you click the Add to subscription button, StackPath will require you to confirm the subscription. When I published this article, StackPath was charging $25/m for this service.

    If you wish to continue, click Continue. It will take a few seconds for this stage to complete. Once completed, proceed to step 7 below.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
I was not prompted to add billing information here because I already did that. You may be prompted to add your credit card at this stage.
  1. To proceed to the next step, click Set Up Your Origin.
  1. On the next page, StackPath will display the IP address of your Discourse forum in the “Origin Hostname / IP Address” field. Confirm that it is the correct IP address.

    Then, scroll down to the “Do you want to add a custom domain (for example, cdn.yourdomain.com)?” and select Yes. When you select Yes, the Confirm Origin Address button will change to Add Delivery Domains.
  2. To proceed to the next step, click Add Delivery Domains.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. When the Add Delivery Domains page opens, your Discourse forum (added earlier) will be displayed.

    Beneath your Discourse forum’s URL, add your CDN subdomain. Then, click the Add button.
  2. Once your CDN subdomain has been added, click Confirm Delivery Domains.
Most people simply add “-CDN” to the subdomain of their Discourse forum URL. In this example, I am using community-cdn.www.itechguides.com.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. Then, on the “Select an SSL Method (Optional)” page, accept the defaults. Then, scroll down and click Accept SSL Method.
How To Configure CDN For Discourse With StackPath - How To Create A StackPath Account And Configure Your StackPath "Site"
  1. Once you click Accept SSL Method, the Validate with DNS Challenge page will be displayed. You will use the information displayed here to validate your ownership of your Discourse forum URL domain.

    You will complete this task in the next section.

Step 2: Verify Domain Ownership

This is the next step to configuring CDN for your Discourse forum is to verify your domain.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
In this example, I am updating the DNS record for Cloudflare. You should be performing this task where your domain’s DNS record is managed.
  1. Login to your DNS provider’s site, locate manage DNS and click Add. If you use Cloudflare, log in to Cloudflare, then, open your active domain hosted by Cloudflare.
This is the next step to configuring CDN for your Discourse forum is to verify your domain.
  1. Then, on the left pane of the left pane, click DNS.
  1. On the DNS management page for your domain, create two CNAME entries – one for your CDN domain, and the second for the forum domain. In my example, community.itechguides.com, and community-CDN.www.itechguides.com.
  1. Back to your StackPath setup page, expand the “Validate with HTTP Request” section. Then, in your DNS provider, create a CNAME record for your CDN domain.

    Use the information provided by StackPath.
Before you can create a CNAME for your forum’s subdomain (in my example, “Community.www.itechguides.com”), you must delete the existing A record for the same subdomain in your DNS entry.

If you use Cloudflare, make sure to turn Proxy status off.
  1. Still, on the StackPath website, scroll down and check “I have completed one of the above validation steps to verify I own the domain.”. Then, click Verify Domain Ownership.
  1. Once StackPath has verified that you own the primary domain, it will display the information you require to Update Your DNS.
  2. Open the DNS management on your DNS provider’s page and create the A record. StackPath will display the information you require on the Update Your DNS page.
DO NOT add the A record to point to your root domain as shown by StackPath in the screenshot below. Rather, instead of using @ for the name of the A record, use the sub-domain name for your Discourse forum URL. In my example “community”.
You do not need to create the CNAME record. I am not sure why StackPath is requesting for these two records to be created. All you need is to create the CNAME record for the CDN domain (which you’ve already done in step 3 above). Then, in step 7, you have added an A record for your Discourse forum URL subdomain.

There is one more step to complete the configuration of CDN for Discourse with StackPath. See the next section for details.
  1. Finally, check the “I have completed the above steps to point my DNS to StackPath.” box. Then, click Complete Setup.
Before you proceed to the next step, click EdgeSSL. Then, confirm that StackPath has successfully issued your domains a free SSL certificate. Finally, turn “Force HTTPS Connections” ON.

Step 3: Update your Discourse App.yml

This is the final stage to configure CDN for Discourse with StackPath.

Popular on Amazon
Sale
Cudy Gigabit Multi-WAN Router, OpenWRT, Load Balance, 5x GbE, R700 | OpenWRT-ready Multi-WAN tunnel gateway, 5x GbE ports, WireGuard/OpenVPN/IPsec, traffic Balancing, Failover, VLAN, QoS
  • Multi-WAN Business Continuity: Connect up to 5 ISPs with automatic failover and load balancing — if one connection drops, traffic instantly reroutes to keep your business, remote office, or home lab online
  • OpenWRT-Ready Enterprise Control: Full OpenWRT support unlocks VLAN segmentation, advanced firewall rules, custom QoS policies, and community-developed packages for professional-grade network management
  • Complete VPN Gateway Suite: WireGuard, OpenVPN, IPsec, PPTP, and L2TP server and client built in; create site-to-site tunnels, host remote access, or route specific VLANs through encrypted VPN connections
  • Professional Security Stack: SPI firewall, DoS attack prevention, IP/MAC binding, domain filtering, and DMZ hosting protect your network perimeter while keeping critical services accessible
  • Flexible Deployment & Monitoring: Web GUI or Cudy App cloud management with TR-069 support; built-in diagnostic tools (Ping, Traceroute, NSLookup, system logs) for rapid troubleshooting anytime
  1. SSH to your Discourse host server. Then, run the commands below. The second command will open your Discourse app.yml file for editing.
cd /var/discourse
nano containers/app.yml
  1. When the app.yml opens, uncomment the CDN line and update it with the CDN CNAME you set up in your DNS. Before you uncomment the CDN line, it will look like the highlighted portion of the screenshot below.
Update Your Discourse App.yml File With The StackPath CDN Entries
  1. Now, remove # in front of DISCOURSE_CDN_URL: https://discourse-cdn.example.com and change “https://discourse-cdn.example.com” to your CDN URL. When you finish, the CDN line will look like this:
DISCOURSE_CDN_URL: https://community-CDN.www.itechguides.com
Chnage https://community-CDN.www.itechguides.com to your CDN domain URL.
Update Your Discourse App.yml File With The StackPath CDN Entries
  1. When you’re happy with the changes to the app.yml, pres Ctrl and X keys on your keyboard simultaneously. Then, app.yml will prompt you to save the file – type Y and press enter.
  2. Finally, to rebuild your Discourse container for the changes you made to take effect, run the two commands below.
cd /var/discourse
./launcher rebuild app
Update Your Discourse App.yml File With The StackPath CDN Entries
  1. Wait for Discourse to complete the container rebuild. Then, to confirm that your static assets are now served via the CDN, open your forum in a browser.
  2. Then, right-click anywhere on a page and click Inspect.
  1. Next, click the >> next to Elements and select Network.
  1. Finally, refresh the page by pressing F5. If you point to an asset, StackPath should now serve the static assets from your CDN URL.
You have successfully configured StackPath for your Discourse forum!
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Frequently Asked Questions

1. What is Discourse CDN

Discourse CDN means to enable CDN for your Discourse forum. Enabling CD for your Discourse forum means that your Discourse forum’s static assets are served from the CDN provider’s wide network across the globe.

The implication is that your forum loads faster for your visitors.

2. How do I create a Domain CDN?

To create a domain CDN, add the CDN URL when you configure CDN on your provider’s site. When you do this, your provider will display the A and CNAME records you need to add to your DNS provider.

Next, open your account on your DNS provider’s website and create the A and CNAME records. The A DNS record will point your original domain URL to your CDN provider’s provided IP address.

On the other hand, the CNAME record will point your CDN domain to the CDN URL your CDN provided assigned to your domain when you signed up.

Also popular on Amazon
X-MEDIA XM-PS110P 1-Port 10/100Mbps Fast Ethernet Parallel Print Server | Parallel Centronics Port Network Print Server
  • Compatible with up to 230 printer models on the market
  • Supports Multi-Protocol and Multi-OS, easy to set up in almost all network environments
  • Supports POST (Power On Self Test) and E-mail Alert, to help identify printing problems as soon as possible
  • Simple setup and management, very easy to operate
  • NOTE *** For more Printer Compatibility information, see the PDF File of Compatibility Guide under Product Guide & Documents
3. Is Discord and Discourse the same?

No, Discord is different from Discourse. While the two names may sound similar, they are not the same!

Discord is a video game chat service while Discourse is forum software.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
4. How do I set up a Discourse server?

There are two main steps to setting up a Discourse server. 1, create a cloud server with one of the popular providers like DigitalOcean.

Then, install Discourse, start it, and complete the setup.

Also popular on Amazon
TRENDnet Gigabit Multi-WAN VPN Business Router, TWG-431BR | 5 x Gigabit ports,1 x Console Port,QoS,Inter-VLAN Routing,Dynamic Routing,Load-Balancing,High Availability
  • INTERFACE: 5 x Gigabit ports (Modes:4 WAN ports/1 LAN port or 1 WAN port/4 LAN ports), 1 x USB 3.0 port,1 x RJ-45 console port
  • MANUFACTURER PROTECTION: We stand by the quality of our products.The TWG-431BR Gigabit Multi-WAN VPN Business Router is backed and supported with 3 years of TRENDnet Manufacturer Protection.
  • NDAA and above TAA COMPLIANT: With our NDAA and TAA compliant Business Router, you can plan and install networking solutions that Government customers demand today (U.S. and Canada Only)
  • RELIABLE TECH SUPPORT: Our team of advisors, support and tech experts are English speaking, and available for all your needs during normal business hours. We take pride in being there for our customers.
  • GIGABIT MULTI WAN: The router supports up to four separate WAN internet connections to efficiently load-balance traffic by distributing network traffic to the best available link.
5. What is a Discourse group?

When you set up a Discourse forum community, the Discourse software offers you multiple ways to control access to resources. One of such ways is by creating Discourse groups.

When you create a Discourse group, you can determine Discourse users that own the group and determine users that belong to the group.

Not only that, but you can also set permissions on the group and configure other additional settings.

Conclusion

The Discourse forum software comes with built-in support for CDN. However, as of when I configured Itechguides Community in June 2022, there was no step-by-step guide.

After some research, I decided to StackPath CDN for our Discourse. In the process, I decided to document the steps so that other people could benefit from them.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

I hope that you were able to configure CDN for your Discourse forum with StackPath by following this guide. If you found the guide helpful, click on “Yes” beside the “Was this page helpful” question below.

You may also express your thoughts and opinions by using the “Leave a Comment” form at the bottom of this page.

Finally, to read more articles about WordPress and websites, visit our WordPress & Websites How-Tos page.

Quick Recap

Bestseller No. 2
X-MEDIA XM-PS110P 1-Port 10/100Mbps Fast Ethernet Parallel Print Server | Parallel Centronics Port Network Print Server
X-MEDIA XM-PS110P 1-Port 10/100Mbps Fast Ethernet Parallel Print Server | Parallel Centronics Port Network Print Server
Compatible with up to 230 printer models on the market; Supports Multi-Protocol and Multi-OS, easy to set up in almost all network environments
$74.99
Bestseller No. 3
TRENDnet Gigabit Multi-WAN VPN Business Router, TWG-431BR | 5 x Gigabit ports,1 x Console Port,QoS,Inter-VLAN Routing,Dynamic Routing,Load-Balancing,High Availability
TRENDnet Gigabit Multi-WAN VPN Business Router, TWG-431BR | 5 x Gigabit ports,1 x Console Port,QoS,Inter-VLAN Routing,Dynamic Routing,Load-Balancing,High Availability
MANAGEMENT: Supports web browser (HTTP, HTTPS), CLI, SSH and Telnet management; RACK MOUNT DESIGN: Sturdy metal housing with rack mount brackets included
$129.99

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.