# CDN delivery

> Serve your video assets through a CDN.

For ongoing playback from your own storage, configure a CDN that serves the bucket and add its base URL to the storage connection. Chunkify uses that URL and each generated object key to produce playback URLs. See [Output paths](/docs/video-streaming/storage/output-paths) for how those keys are built.

Follow the [Amazon CloudFront guide](/docs/video-streaming/storage/cloudfront) for S3, or the [Cloudflare guide](/docs/video-streaming/storage/cloudflare) for R2.

## Configure the CDN base URL

Set `cdn_base_url` on customer-owned storage to the HTTPS origin that serves its objects, such as `https://media.example.com`. Chunkify appends the full object key to that origin. If the HLS master playlist is stored at `media/videos/video-123/asset_2G6MJiNz71bHQGNzGwKx5cJwPFS/manifest.m3u8`, its playback URL is:

```text
https://media.example.com/media/videos/video-123/asset_2G6MJiNz71bHQGNzGwKx5cJwPFS/manifest.m3u8
```

The CDN hostname root must map to the bucket root, including the output prefix. The base URL cannot contain a path, query string, fragment, or credentials. Adding it to Chunkify does not create a CDN, change bucket permissions, or verify that the hostname works. Changing it later changes the CDN URLs Chunkify returns for existing files, but does not move those files.

If you expose a bucket through a public domain, every object in that bucket can be public, including source videos stored there. Keep private sources in separate storage or use delivery controls appropriate to your CDN. A `cdn_url` is unsigned; a private CDN needs its own access mechanism, such as signed cookies or URLs.

## Preview and CDN URLs

When `playback_ready` is `true`, a video asset can expose two URLs for its HLS master playlist:

- `preview_url` is a public URL meant for testing that is provided when `preview_enabled` is `true`.

- `cdn_url` is available when the selected output storage has a configured `cdn_base_url`. It points to the playlist through your CDN. Use it for playback in your application.


## Verify playback delivery

Before using the CDN URL on your website, check that:

- Its DNS name and HTTPS certificate work, and the hostname serves the expected object keys.
- HLS playlists, video and audio segments, posters, timeline previews, and captions load from the viewing website. [Configure CORS](/docs/video-streaming/storage/cors) covers the browser rules.
- The CDN preserves media content types and byte-range responses.
- Cache rules allow playlists that change during processing to refresh, while completed media files can stay cached.

Test the video asset's `cdn_url` in a browser on your actual website. A valid URL returned by Chunkify does not by itself confirm that the CDN is serving the files correctly.
