Using a CDN off the shelf is like buying an economy sedan off the lot and then racing at the Daytona 500. The car will get you to work and back, but you’re not going to beat a highly-customized racing machine fine-tuned for speed, performance, and durability.
In our Five Advanced CDN Configurations for the Serious User blog series, we’ll cover the top five practices to get the very most out of your CDN.
Tip #1: Customize Your Edge Behavior
One way of looking at the workflow of content being accessed via CDN is as a series of queues, ordered based on the first request for a piece of content.
On each of these queues there are identifiable header characteristics like the client user agent and IP, the requested path to the content or the file type of the content. Use these characteristics and relevant imported content like geographic IP lookup maps, to alter headers and subsequently behaviors to achieve various end goals.
You may need a Script Engine that lives on the CDN edges and transforms any header data based on arbitrary characteristics of the data, user, or imported settings. What this means to your site delivery can vary widely thus it’s very important to customize Script Engine carefully to ensure the best possible results.
Some examples of uses for Script Engine include the following:
PLATFORM SPECIFIC CONTENT
Set Top &
OTT Device Content
Say you want to use three different data sets for your content depending on the client platform accessing it, but your CMS is incapable of making the distinction, or you’re delivering your content via a published web service and don’t have control over its framing. This can be accomplished via a Script Engine match on the User Agent of the client device.
FILENAME PATTERN BASED TTLS (TIME TO LIVE)
What if you have a set of files with differing cache expiration needs, identifiable only based on complex pattern matching from within the file name?
By creating a script that matches the substrings and placing it on queue 3 (origin to edge), a CDN can appropriately set the time to live on each file within the cache as if it were understood natively by the origin.
REGIONAL CONTENT REDIRECTION
If you work in the media, you may be familiar with the complex web of distribution rights that can come into play when publishing premium content. You can have the rights to a music video catalog in North America but not in Europe, for instance.
One way to resolve this would be to use a geo blocking feature, although that will result in an access denied error. If you’d prefer to hand off clients to your authorized partners in another region you could leverage Script Engine to accomplish that.
A script on queue 1 (client to edge) can be configured to detect an end user IP address and look them up in a geo IP database. If the region matches the allowed set, the CDN will pass their request on to the origin, pull the file into cache, and deliver as usual. If the user doesn’t match the allowed region, but does match the region of a known partner, they will be given a redirect response to view the page of the eligible partner instead.
IDENTIFY & DELIVER SSL & NON-SECURE CONTENT DIFFERENTLY
A script can be used to force HTTPS redirects, as well as identify which content is to be delivered via HTTP vs. HTTPS. If you have a business case where you need to separate HTTP and HTTPS traffic, Script Engine can enable this behavior.