Content Delivery Network Support (CDN)

Content Delivery Network (CDN) is a network with servers that reduces the network traffic to your primary server/s. A CDN network often has multiple servers and the different servers are placed around the world. You as client will be using the nearest server to you depending on you IP-address; the reason is that data should be sent shortest way over internet to get better speed.

What is Content Delivery Network (CDN)?

There are many types of CDN and here we describe the two most common:

1. The simplest one is that you manually uploads file to the CDN and then the CDN is served with the uploaded files.

2. The second one is called edge-caching and automatically gets populated with files from an origin server. This means that the first request from PoPs (point of presence) downloads content from the main server. In the following example the main site is and a CDN is created with domain For every request we do to where the CDN does not have the requested file, the CDN downloads the file from and caches the file based on the cache-header included in the response. For all subsequent requests for the same file the CDN already has the file cached and can serve directly with the cached content.

Does Litium Studio have CDN support?

Yes, Litium has built-in support for edge-cache CDN to reduce requests for all anonymously accessible files and/or images stored inside the product. All requests not accessed by anonymous users will be served directly by Litium as before to be able to access control of the files.

How does this work inside Litium Studio?

When activating the CDN support for edge-cache all file links are rewritten to include the domain-name for your edge-cache domain; as in example above

I have static files in a folder on the site; can I use edge-cache for them also?

Yes you can. In Litium there is a built-in CDN-filter that will parse the response and add a hostname before the static files.

E.g. change tags from :

<img src="/ui/img/image.jpg" />


<img src="" />

How can I activate the CDN support?

Create an account at a CDN supplier

Start by creating an account at a CDN supplier and setup the CDN. The CDN should probably point directly to your main domain as origin server. Go to for a selection of CDN suppliers.

Configuration in Litium

After you have created your account at the CDN supplier you need to setup Litium. All configurations that you need to change are in the web.config. (If you will not use cdn-filter you can skip those steps).

  1. Open the web.config
  2. Add the attribute useCdn="true" and cdnHost="" (replace with your CDN-domain name) to the storage-element. The element should now look like.
    <storage cdnHost="" useCdn="true" />
  3. If your CDN supports secure content (https) you should also add the attribute useCdnForSecureContent="true"; otherwise requests for secure content will not be directed to the CDN to avoid broken images on your site.
    If your CDN for secure content not is the same as non-secure content you can specify the secure content CDN with the attribute cdnSecureHost="".
  4. Find the element cdnFilter inside the section litium\studio. If the section is not found you should add the section and configure with your settings. To be able to use this section the section need to be declared in the declarations of "studio"-section with <section name="cdnFilter" type="Litium.Studio.Configuration.CdnFilterSection, Litium.Studio" />cdn.png
    - the attribute secureContentHost is optional and if the attribute is excluded replacement when browsing secure content (https) pages is also excluded.
    - the attribute insertAfter is optional and if excluded the default " is used.
    In the above example we make several redirects to different hosts as an example for multiple matches to different hosts.
  5. Save and close your web.config

Multiple domain hosts for CDN

If you need to speed up loading of content from the CDN you can use several CDNs, e.g.,, to reduce the requests to a single hostname. Why should I use multiple CDN domains? Browsers are built only to do a limited number of simultaneous requests to each domain name. By using multiple domain names you can get faster response times.

To enable multiple hosts for storage you simply put multiple hosts in the cdnHost and/or cdnSecureHost attribute separated by comma (,). Litium is then built to spread the request over the CDN hosts but always use the same host for the same file.

Multiple domain hosts for CDN are only available for storage, not cdn-filter.