StackPath offers a range of services for any online application including CDN services. Let’s check how well its CDN services works with WordPress and if you should use it for your blog?
In the last few blog posts, I have talked a lot about the CDN services and how essential they have become for any successful blog. As soon as you setup your blog, you should be looking for CDN services to reduce the load on web server and speed up the content delivery.
There are many companies which offer CDN services but we need to check how well they work with our CMS. I always prefer WordPress based solutions to start with as it can speed up the site setup process. Also, the availability of different services and integrations means that we can create almost any kind of site with WordPress.
Last time when I talked about CDN services, I said that I prefer to start with Amazon CloudFront. The pay-per-use pricing means that it becomes much more affordable at the start of the blog. You end up paying for only the bandwidth which you use, no minimum monthly payment.
Table Of Contents
StackPath CDN Services
Though Amazon CloudFront is the solution which I preferred to start with, it has it’s on problems in the long run. You can only serve static files on the AWS CloudFront and they charge to invalidate any file on the CDN service.
This means that you have to be careful while cleaning your CDN cache. The best approach is to give the files a new name rather than invalidating your cache. I have ranked some big bills because I was testing some cache option and it has invalidated almost all the files on the service.
This is where StackPath CDN service comes as, with a fixed monthly bill, they can offer much better bandwidth and easy cache invalidations. StackPath CDN service starts at $10 and gives you 1TB bandwidth for a month. Compare it with Amazon CloudFront, you will be spending around $80-$115 for a similar bandwidth.
StackPath pricing is $10 for the first 1TB of bandwidth with all the global PoP’s included in the pricing. So you pay around $0.01 per GB with StackPath where with Amazon CloudFront the pricing starts with $0.08 per GB.
Even if you cross the 1TB limit, StackPath only charges $0.04 per GB which is still half of what you pay for Amazon CloudFront.
Here are some of the comparisons based on per month usage (For AWS CloudFront, we have only considered basic pricing, it can be more based on the region used for CDN).
|Total Monthly Usage||StackPath Pricing||AWS CloudFront Pricing|
Now, why I say you should start with Amazon CloudFront?
Because at the start of the blog you may only need a few GB’s of bandwidth. Which means, your monthly bill with Amazon CloudFront will be few dollars. Once it starts to reach $10 a month, you should look to move to StackPath. You will get much better and easier service with StackPath.
So, once the pricing constraints are out, let’s take a look at some of the best features of StackPath CDN Services.
Create A Stack
StackPath works with a concept of Stacks. Services bundled together to get your work done. First thing, which you will do with StackPath is to create your stack. A stack can contain multiple sites, it’s about combining services which you need for those sites.
Just give a name to the stack and select Website & Application Services.
Since we are only talking about CDN service, we will only add an individual CDN service. You can also choose to select the EDGE Delivery package which includes WAF and DNS services from StackPath.
Based on the selected stack, you will be charged. Once the stack is created, you can add your site to that stack.
Add A Site
A stack can contain multiple sites and the limits are applicable to all the sites under that stack. So when we say 1TB bandwidth for the stack, your all sites combined together have that bandwidth.
Just enter the name of the site and services which you would like to enable for that site. It will scan the DNS name and asks you to confirm it. Once confirmed that site will be added to your stack and it will have a generated Edge Address.
You can use that edge address to transfer all your files to the CDN service. It will be a pull request, if the file is available, it will be served. Otherwise, It will pull the files from your site.
StackPath works with some of the best cache plugins on WordPress like W3 Total Cache. Their direct partnership means that you will get an easy setup and management option from your WordPress Dashboard.
Just go to your W3 Total Cache -> General Setting and enable the StackPath Recommended option for CDN.
Once you have enabled the CDN service, the only other thing which is needed is adding the API access for StackPath. You can do that in your API Management Screen on StackPath dashboard.
Just create the API Client ID and Client Secret Key, add it to WordPress dashboard at W3TC -> CDN. Once done, it will ask for the site which you can select for the popup.
W3TC also allows you to create a new site in the stack if you have not created the site previously. You can use that option in case you want to create the CDN site from your WordPress Dashboard.
Most of the default settings should work fine and your files should be delivered from the StackPath CDN service. If you want to make some customization, you can do it at the CDN settings in W3TC.
Because of the deep integration or partnership with W3TC, you can manage the cache invalidation from your WordPress Dashboard. No need to manage it separately.
Setting SSL and CDN Subdomain For StackPath
If you have already set up SSL for your main domain than would like to serve your CDN also with an SSL.
StackPath Edge location is already SSL enabled, so it will be served over SSL automatically. If you just want to serve your content over SSL, enable the SSL support in the W3TC CDN settings. This will make sure that the CDN URL will always start with HTTPS rather than HTTP.
If you want to server the CDN content from your subdomain vs StackPath Edge Location, you have to add it as a delivery domain in the site settings.
Their plan also comes with free SSL certificate for all the domain which are using with the DNS services of StackPath. To use that free SSL certificate, you need to host the DNS with them. You can enable it with just one click of the button.
Just make sure that CDN custom domain is pointing to your Edge Location and it’s added in delivery domains. Enable the Free SSL certificate and it will be served over SSL.
Upload Custom SSL Certificate
If your DNS is hosted somewhere else, you can still upload the custom SSL certificate to serve it over SSL with custom domain name.
First thing first, you need to make sure that the SSL certificate includes the custom CDN domain name. If not, please re-issue the certificate with the CDN custom domain name.
Once your certificate has the domain name, just upload the files or copy-paste the content in Upload My Own screen in StackPath.
If you have used our SSL Guide For AWS LightSail, you can find your SSL certificate in /etc/letsencrypt/live/domainName.
Here are file mappings which you will need –
Certificate -> cert.pem
Private Key -> privkey.pem
CA Bundle -> chain.pem
Just upload those 3 files and you should be good to go.
Once the sites are added and your content is getting delivered from the delivery domain, the rest of the settings are very easy.
You can add the CORS headers or Browser Cache TTL with the help of just dropdowns in the site setting page. They also offer the Gzip compression and HTTP/2 support for content delivery.
StackPath comes with 45 different PoP locations across the world for your content delivery. These locations are spread across different countries and regions so that they can easily deliver the content from the closest location.
Based on CDNPerf performance testing, the difference between AWS CloudFront and StackPath performance is 3-4 milliseconds. This should not have much impact on your site content delivery. If you only consider the North American region, StackPath is little ahead of AWS CloudFront in terms of performance.
The uptime is also very comparable between these CDN services which means that the content delivery will not be impacted. So overall you will get decent performance and uptime with StackPath CDN services.