# Use a custom domain or CDN for your media

To serve media from an address you own, connect the domain to your bucket at your provider, wait until it answers over https, then enter it in **Offloft → Settings → Delivery** and run the delivery test. Images switch to the new address only after the test loads a real file from it.

## Steps

1. In your provider's dashboard, connect the domain to your bucket. With Cloudflare R2 on the same Cloudflare account, use the bucket's custom domain setting. Elsewhere, add the CNAME record your provider shows at your DNS host.
2. Wait for the domain to answer over `https://`. This can take a few minutes after a DNS change.
3. In Offloft, open **Settings → Delivery**, enter the domain and run the delivery test.

If the test fails, your media keeps loading from your server, and the message says what to look at.

## Each provider

The [setup guides](/docs/connect-a-provider) have an optional step for this where it applies. Some providers set conditions: R2 needs the domain on the same Cloudflare account, and a Wasabi bucket served through Cloudflare must be named after the domain.

## Cache lifetime

**Cache lifetime** sets how long browsers and CDNs may keep a copy, one year by default. Without versioned file paths, it's one day at most, so replaced files show up. It applies to files offloaded from then on.

Updated 2026-11-06.

Source: https://www.offloft.com/docs/custom-domain-or-cdn
