There are many ways to customize your content delivery. From instantaneous cache purge to query string control, you can customize TTLs and more to configure the delivery of your content across the CDN for a fully optimized experience. This article will explain how each setting works.
How to access CDN Configuration Settings
- Log into the StackPath Control Portal
- Select Sites from the left-side navigation
- Select the Site you wish to configure from your list of Sites
- From the Site Overview page, select the Settings tab
Your site's Edge Address
If you're not using StackPath as a DNS provider you'll need to either set the DNS records for your delivery domains as CNAME types with this value or input this value into your CMS caching plugin. Your site's Edge Address supports both HTTP and HTTPS delivery. Please note that Dynamic content (such as HTML or PHP) is not cached when the StackPath WAF is enabled. To learn more about the Edge Address please view a more detailed description here.
Site Settings: Origin
The protocol, domain, and path that we will use to retrieve content from your origin server, this field usually contains the IP address of your server to ensure we have a direct connection.
In the event an origin server experiences failure, a backup origin can be entered. For more information about how backup origins work, please view our article here.
The Host Header is a request header our system sends to your origin server. By default, this is set to dynamic, but if your server is expecting a specific custom header, you can add that value to your Delivery Domains section, and select it from the drop-down for Host Header.
This setting will determine the protocol with which the CDN connects to your origin server. You can choose between HTTP Only, HTTPS Only, or HTTP or HTTPS (if your origin supports both protocols).
Site Settings: Delivery Domains
This is the list of domains for which StackPath will use this site configuration to respond to requests. Add a delivery domain for every domain you wish to use this configuration.
CDN Settings: Purge
Custom Purge allows you to selectively purge assets from your CDN Cache by specifying a URL or a specific file path.
Selecting Purge Everything will purge all assets from your CDN Cache.
CDN Settings: Cache Handling
Set the maximum length of time that the CDN will cache your content before going back to the origin, or defer to the value passed by your origin.
- Origin Controlled
- The StackPath CDN will honor the cache-control headers.
- Specify CDN TTL
- Static content will be cached (and will not expire) based on the TTL configurated.
- Dynamic Content will be cached based on the origin cache control headers.
- Never Expire
- Static Content will be cached and will not expire.
- Do Not Cache
- Static and Dynamic resources will not be cached, and a request will be sent to the origin server for each request.
Query String Control
Determine how you want StackPath to treat URLs that have a query string portion (a "?" followed by a series of keyword/value pairs represented by "&x=y". Ignoring the query string means we will cache https://example.com/file.txt?ver=1 and https://example.com/file.txt?ver=2 identically based on which is requested first. "Standard" behavior is that we will cache these 2 URLs distinctly
Enable this to reduce the file size of your text-type content, which will improve delivery speeds. You can select a level from 1 (least compressed) to 6 (most compressed) if you're concerned about the CPU impact of decompression for your end users. For more information about how the StackPath CDN works with gzip, please view this article.
Enable this to keep content in cache beyond its expiration time in case we can't reach your origin. We'll check the origin, and if the file is there, we'll update it. If not we'll serve the expired asset from cache.
Vary is an HTTP response header that allows distinct variations of the same content to be cached using the same URL. The content is selected based on the value of the specified Request header, to ensure the right content is served to the right place.
When enabled the
vary header option allows the StackPath CDN to follow your origin server's
vary header when making origin pull requests. When Disabled, the CDN will ignore the header when making origin pull requests.
CDN Settings: Client Browser Policy
Browser Cache TTL
Set the length of time that client browsers use to locally cache your content, or defer to the value passed by your origin
CORS Header Support
Cross-Origin Resource Sharing (CORS) is a mechanism that uses additional HTTP headers to tell a browser to let a web application running at one origin (domain) have permission to access selected resources from a server at a different origin.
Enabling this feature will send an "Access-Control-Allow-Origin: *" header in the response which will indicate to the client browser which client origins will be allowed to access a resource.
HTTP/2 is the next generation of web protocol. It has features like binary encoding and multiplexing that make web connections faster and more efficient if your site is designed to make use of them.
Please note that StackPath HTTP/2 support does not include Push, and is only used on the connection between the client and the edge. Using HTTP/2 to the origin would in most cases have small to nonexistent performance benefits. HTTP2 is only available for encrypted requests (HTTPS)