StackPath Support

Custom SecureCDN Integration

This tutorial assumes a site is created.

It's important to understand the difference between an origin URL and CDN URL before moving further in this tutorial.

An origin URL is a URL such as http://yourdomain.com that points to a main server. An CDN URL is the URL automatically generated after a site is created. This looks like http://site.company.stackpathdns.com. If a custom CDN URL is created using a CNAME record, the CDN URL looks like http://cdn.yourdomain.com.

Configuration

If implementing StackPath CDN with a custom-built site, go into the source code of the site and point static content to its corresponding CDN location. To do this, replace the origin URL with the CDN URL.

The location of files on CDN sites mirror the location of static content on the origin server. For instance, if there is a file on the origin located at yourdomain.com/images/logos/big.jpg, its location on our CDN would be http://site.company.stackpathdns.com/images/logos/big.jpg.

Therefore, changing the URLs in your source code looks something like this:

Replace

<img src="ORIGIN_URL/images/logos/big.jpg" alt="" /> OR

<img src="/images/logos/big.jpg" alt="" />

With

<img src="CDN_URL/images/logos/big.jpg" alt="" />

All you're doing is swapping the origin URL for the CDN URL.

Do not alter the URLs of pages and dynamic content.

Return to top