Add to CDN on a bucket creates a distribution with the bucket as its origin, so the bucket’s files, such as images, scripts, and videos, are served from edge locations near each visitor. MyAccount fills in the bucket’s address for you.
Before you begin
Section titled “Before you begin”- CDN is on for your account. If it is not yet, Add to CDN asks you to request it first. See Request CDN.
- You have a bucket with your files in it, in the folder structure your site expects. See Create a bucket and Upload and download objects.
- The bucket has public access turned on, with Download and Listing checked, so that anyone can read its files. Add to CDN needs both. Without them, it stops with Public Access Required: “Your bucket <name> is not public. You need to enable public access to create a CDN with this bucket.” See Make a bucket public.
Public access opens every file in the bucket to anyone who has its address, so keep only files you mean to publish in this bucket. Add to CDN does not open Select CDN plan. For how CDN is billed, see How is CDN billed?.
Add the bucket to the CDN
Section titled “Add the bucket to the CDN”- In MyAccount, open Object Storage, with the bucket’s region selected, and find the bucket in the list.
- In the bucket’s Actions menu, choose Add to CDN. The form
CDN Distribution with <bucket> as origin opens, with your bucket’s name in place of
<bucket>. - Check Origin Domain Name. It is filled in with the bucket’s address for the region selected,
and stays as it is:
<bucket>.objectstore.e2enetworks.netin Delhi, or<bucket>.in-south1-objectstore.e2enetworks.netin Chennai. - Leave Origin path empty to serve the whole bucket. The bucket’s name is already part of
Origin Domain Name, so entering
/<bucket-name>makes the CDN look for a folder of that name inside the bucket, and your files get an HTTP 404 error. - (Optional) To serve only one folder of the bucket, enter it in Origin path, such as
/videos. Start it with/; spaces cannot be typed. The field reads Path should start with slash(‘/’) when the path does not start with/, and Path cannot be only slash(‘/’). when it is only/. - Keep Origin ID as it is filled in. It is required, and the bucket’s Bucket CDN tab finds the distribution by it.
- Click Create CDN. To go back without creating anything, click Cancel.
A bucket’s distribution always uses E2E SSL Certificate (*.e2enetworks.net): it serves your files at its own Distribution URL. To serve files at your own domain name, the origin must be on your own domain; see Create a distribution.
Bucket CDN created successfully confirms it, and you are back in Object Storage. The bucket gets a Bucket CDN tab with Distribution ID, Distribution Domain URL, Distribution State, Domain name, Distribution Status, and Created On (IST). Add to CDN is no longer available for this bucket.
Close the bucket’s file list
Section titled “Close the bucket’s file list”Once the bucket is added to the CDN, anyone can see the names of all the files in it at the
Distribution URL’s root address, https://<distribution-url>/, because Add to CDN needs
Listing checked. To keep the names private, open the bucket’s Permissions tab, click
Public Access Config, clear Listing, keep Download checked, and click
Save Permission. The root address then returns an HTTP 403 error, and your files keep loading
through the CDN.
Before you later delete this distribution, check Listing again, so that Add to CDN becomes available for the bucket after the delete; see Delete a distribution.
For a website, also set Default Root object to your home page, such as index.html, so the root address returns that page in place of the 403 error; see Change the basic settings.
If the CDN served the list before you closed it, it can keep serving that copy until you clear the
cache for the path / with Flush Cache on the distribution’s Invalidations tab, or the copy
expires. See Clear the cache.
Wait for Deployed
Section titled “Wait for Deployed”In MyAccount, under Network, click CDN. The new distribution is on Manage CDN Services, with the bucket’s address under Domain Name. It shows InProgress and Disabled while it deploys, which takes up to 30 minutes, and the page can show the change up to 15 minutes after that. When it shows Deployed and Enabled, the bucket’s files are served through the CDN.
Find a file’s CDN address
Section titled “Find a file’s CDN address”Copy the address under Distribution URL. A file’s CDN address is that address followed by the
file’s path in the bucket. For a video at videos/intro.mp4 in the bucket, with Origin path
left empty, it is:
https://<distribution-url>/videos/intro.mp4Here, <distribution-url> is the address you copied. To check it, run:
curl -I https://<distribution-url>/videos/intro.mp4The status 200 on the first line of the output means the CDN served the file. Use the CDN
address in your site’s pages and video players in place of the bucket’s own address.
Manage the distribution
Section titled “Manage the distribution”Clearing the cache, changing settings, disabling, and deleting a bucket’s distribution are all done on Manage CDN Services. The bucket’s Bucket CDN tab shows the distribution’s details, and has no controls of its own.
- When you replace a file in the bucket, visitors keep getting the cached copy until it expires. To serve the new one sooner, see Clear the cache.
- When you delete the distribution, MyAccount first warns “This CDN distribution is serving content from the bucket <name>.” After the delete, Add to CDN is available for the bucket again. See Disable or delete a distribution.
A bucket as the origin of Create CDN
Section titled “A bucket as the origin of Create CDN”You can also enter <bucket>.objectstore.e2enetworks.net as Origin Domain Name on
Create CDN. That distribution works the same way, but the bucket gets no Bucket CDN tab,
and Add to CDN stays available for it. Add to CDN is the simpler way, since it fills
in the origin and links the distribution to the bucket.
Your bucket’s files are now served through the CDN. If Add to CDN stops you, or a file does not load, see Troubleshooting CDN.