## Introduction

### Goal

Serve images and assets through a CDN by configuring a CDN host for your channel.

### Background

Images and assets uploaded to a Bloomreach Content environment can be [accessed through the Delivery API](🔗) for use in frontend applications. By default they are served from your Bloomreach Content environment's domain (`*.bloomreach.io`).

It's possible (and recommended) to serve images and assets through a CDN by configuring a CDN host for a channel. The [Delivery API](🔗) uses the configured CDN host for any [resource URL](🔗) referenced in the JSON representations in the API responses.

## Configure a CDN Host using the Site Management API

The CDN host can be configured per [channel](🔗) through its `cdnHost` property (also see the [Channel schema](🔗)) using the [Site Management API](🔗)'s [Channels](🔗) endpoint.

The supported CDN host format is:



For example, if you want binaries to be served from `cdn.example.org`, configure:



Other formats like `//cdn.acct.example.org` or `//cdn.acct.example.org:8080` are also supported. Scheme prefixes such as `http` or `https` are supported as well although not recommended.

### Example Channel JSON

Below is an example [Site Management API](🔗) [channel configuration](🔗) with `cdnHost` set to `//cdn.example.org`:



### Example Delivery API Response

Below is an example [Delivery API](🔗) [image set representation](🔗) containing resource URLs using the configured CDN host:



## Technical : Why Should a CDN Start With //

Per [RFC3986 chapter 5.4.1](🔗):



Example 6 is the relevant one:



The advantage of `//` is that it follows the scheme (`http` or `https`) of the request that created the HTML in which references to binary files are added that need to be loaded from a CDN. This way, in the above example, when accessing `http://www.example.org`, all files are served from `http://cdn.example.org` and when accessing `https://www.example.org`, all files are served from `https://cdn.example.org`.