5 Steps to Faster Delivery with StackPath CDN
Today’s consumers expect to get their videos, podcasts, games, and other content, fast. That’s where CDNs come into play, caching your content in points of presence (PoPs) across the world, and serving it to your users before their attention turns elsewhere.
Of course, there are a lot of CDN providers out there, but not all offer the same capabilities. With Stackpath CDN, end-users are closer to content than ever through dedicated, high-performance Edge locations around the globe. However, it’s really about StackPath’s unique, robust delivery optimization and customization features that takes your end user’s experience to the next level – whether through website acceleration, large file delivery, or video/audio streaming.
Here are 5 steps to faster delivery with StackPath CDN.
1. Getting Set Up
For use case purposes, we’re going to set up a website with StackPath CDN. Before you begin, ensure you are able to administer the DNS settings of your website’s public domain name. In our example, we use GoDaddy.com.
Log into the StackPath admin portal and create a new StackPath service (named CDN test in the example below).
Create a new site and provide a name corresponding to the public URL of your website.
Next, StackPath gives you the unique CNAME alias — called the Edge address — to enter in your public DNS namespace, pointing your website to the StackPath environment.
Although the notification says the configuration update could take 24 hours, it typically works within just a few minutes. You cannot continue without this DNS alias validation as proof you are the owner of the DNS domain name.
When the validation is complete, StackPath redirects you to the configuration panel.
2. Configuring EdgeRules
Make StackPath CDN run your way through EdgeRules, providing several configuration options to optimize how your CDN integration works for your delivery needs.
The following features are prepopulated for you:
- Force www Connections: guarantees that anyone connecting to the “naked domain” mydomain.com is redirected to mydomain.com
- Custom robots.txt File: blocks or allows search engines to request specific pages of the website
- Pseudo Streaming: used for Flash player streaming services
- Referrer Protection: inspects header information to only allow traffic directly arriving at the specified addresses
Besides these preconfigured rules, you can specify several custom configuration rules, which follow a simple If / Then approach:
- If Status Code equals 404, redirect to another URL
- If URL matches a specific URL name, configure what happens in caching, from the following list of options:
This rule set is complete, recognizing wildcard, regex, or a direct match with the specified setting (for example, URL or REST API action).
This custom rule definition, not offered by most CDNs, intelligently handles website traffic in cases like these:
- Redirect traffic from one domain to the other, or capture all traffic to the root domain (also known as the naked domain) and send it to mydomain.com
- Redirect website visitors to a mobile version of the website URL, based on header information from the mobile browser’s operating system (for example, iOS or Android)
- Hide specific header information (for example, x-Powered-by, AWS storage, or Google Cloud)
To learn more about creating custom or more complex EdgeRules, head over to the StackPath Support Portal.
3. Turning on Advanced Cache Settings
The main purpose of a CDN service is optimizing website performance, so it shouldn’t be a surprise StackPath CDN has extensive cache settings. You can see a small sample of these in the screenshot below from the CDN Service Control Panel:
- Vary Header: enables you to use a unique string to cache the same asset uniquely.
- Canonical Header: used by search engines to identify the authoritative source of the content. This is helpful for your website’s search engine optimization (SEO).
- Cache Purge: allows you to, at any given moment, purge everything or perform a custom purge operation to clear the StackPath cached information. This may be helpful when moving to a new website, to avoid duplicates and outdated information.
- Browser Cache TTL: this time to live setting determines how long the client’s browser caches the file.
- Query String Control: you can change the CDN’s default of caching all query strings (typically the part of the URL following a question mark) to instead ignore the query string, or create a custom setting to specify which query strings to cache and which to ignore.
- Asset Lifetime Control: defines the TTL (time to live) for objects in the cache. Specifying a higher value reduces the number of cache refreshes, but there is a risk of presenting outdated information. It also depends on the content. For example, images typically change less often than documents or text website content.
- Dynamic Caching by Header: define a specific header, which influences your content caching behavior. (Caching is typically based on the TTL parameter mentioned earlier.) For example, you may want to cache different image sizes of the same file name for mobile and desktop users. When you cache based on the User-Agent header, each device and operating system version has a uniquely-cashed asset, so new visitors with the same User-Agent settings receive that specific file version.
This configuration pane’s biggest advantage is its ease of use. Most of StackPath CDN service’s powerful features and settings just require a toggle on or off.
4. Setting Up an SSL Certificate
Most websites today are protected using an SSL/TLS certificate, letting website visitors know it protects information through encryption. This is especially important when dealing with user credentials, confidential information like credit card details, personally identifying information (PII), and the like.
Most browsers also tell the visitor if your website is protected with a trusted certificate. Having this EdgeSSL integration as part of the StackPath CDN configuration is almost a necessity.
To configure your SSL certificate, first create a free or third party certificate. Then, configure additional options, like forcing http to https redirection or specifying a minimum TLS version, which some websites require.
Note: to use StackPath’s managed certificate service, your domain must point to the StackPath CDN service. If you already have a public or private certificate from another third party certificate authority, you can import this into the StackPath CDN certificate configuration.
5. Activating Origin Shield
Another StackPath CDN feature, not common in other CDN solutions, is Origin Shield.
In a traditional CDN solution, resetting the cache or updating new source content causes each CDN PoP to request new content from the source. This can dramatically impact performance, somewhat bypassing the main reason for using a CDN.
StackPath Origin Shield handles this situation by bundling all requests from the different CDN PoPs to Origin Shield, which in turn sends a single request to the source. This protects the source from getting overloaded.
To configure Origin Shield on your CDN, contact our support team at firstname.lastname@example.org.
Getting Started Today
Whether you’re looking for website acceleration, large file delivery, video/audio streaming, delivering far beyond your end-users’ expectations has never been easier with these 5 steps to faster delivery.