Serve a file from your E2E Object Storage bucket through the CDN, at the address of your first distribution. The CDN keeps copies of the file at edge locations around the world, so each visitor gets it from a location near them. A command at the end shows it working.
A bucket is the quickest origin to start with, since Add to CDN fills in its details for you. To serve files from your own web server instead, see Create a distribution.
You need:
- A bucket in E2E Object Storage with at least one file in it, such as an image. See Create a bucket and Upload and download objects.
- A completed account setup. Otherwise Request CDN opens the profile setup first.
CDN is a paid service, billed through a monthly CDN plan. See How is CDN billed? and E2E’s pricing page.
Ask E2E to turn CDN on
Section titled “Ask E2E to turn CDN on”E2E turns CDN on for your account when you ask, before your first distribution. One request covers the whole account.
- In MyAccount, under Network, click CDN. If you have no distribution yet, click Get Started. Manage CDN Services opens.
- If Create CDN shows, CDN is already on for your account. Go to the next section.
- Click Request CDN.
- In Reason, tell E2E about your business and what you will serve through the CDN, such as “Images and videos for www.example.com”. A reason is required, up to 500 characters.
- Click Request CDN in the dialog.
You see Request for CDN service created successfully., and E2E reviews the request. While it waits, Request CDN opens a message that your request is under process. Once E2E approves it, Create CDN shows on Manage CDN Services in place of Request CDN. Open the page again to check. Meanwhile, you can carry on with the next section.
For what to do if the approval is taking a while, see Request CDN.
Make the bucket public
Section titled “Make the bucket public”The CDN reads your files the way any visitor does, so the bucket must allow anyone to read them. Turn on public access with Download and Listing checked; Add to CDN needs both. This opens every file in the bucket to anyone who has its address, so keep only files you mean to publish in it. See Make a bucket public.
Add the bucket to the CDN
Section titled “Add the bucket to the CDN”Once your CDN request is approved:
- In MyAccount, open Object Storage, and find your bucket in the list.
- In the bucket’s Actions menu, choose Add to CDN. CDN Distribution with <bucket> as
origin opens, with your bucket’s name in place of
<bucket>. - Check the form:
- Origin Domain Name is filled in with your bucket’s address and cannot be changed.
- Leave Origin path empty, to serve the whole bucket.
- Keep Origin ID as it is filled in.
- The certificate is E2E SSL Certificate (*.e2enetworks.net).
- Click Create CDN.
You land back in Object Storage with Bucket CDN created successfully. The bucket now has a Bucket CDN tab, and Add to CDN is no longer available for it.
Close the bucket’s file list
Section titled “Close the bucket’s file list”Now that the bucket is added to the CDN, anyone can see the names of all the files in it at the distribution’s root address, because Add to CDN needs Listing. 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. If you later delete the distribution, check Listing again first, so that Add to CDN is available for the bucket again.
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, clear the cache for the path / with Flush
Cache on the distribution’s Invalidations tab; see
Clear the cache.
Wait for the distribution to deploy
Section titled “Wait for the distribution to deploy”In MyAccount, under Network, click CDN. Your new distribution is on Manage CDN Services, with the bucket’s address under Domain Name. It shows InProgress and Disabled while it deploys to the edge locations. This 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 distribution is serving files.
Copy the address under Distribution URL. You use it in the next step.
Check that a file loads through the CDN
Section titled “Check that a file loads through the CDN”Ask for one of your files at the Distribution URL, from any computer with curl:
curl -I https://<distribution-url>/<file-path>Replace <distribution-url> with the address you copied, and <file-path> with the file’s path
in the bucket, such as images/logo.png. The first line of the output shows the status 200,
which means the CDN served the file. Open the same address in a browser to see the file itself.
Use https://: every new distribution starts with Viewer Protocol Policy set to
HTTPS Only. To let visitors use http:// too, see
Change distribution settings.
Your bucket’s files are now served through the CDN. Put the Distribution URL in your site’s pages wherever they link to these files.
What to do next
Section titled “What to do next”- Clear the cache: make visitors get a file you changed in the bucket.
- Change distribution settings: how long files stay cached, and how visitors connect.
- Create a distribution: serve files from your own web server.
- Troubleshooting CDN and CDN FAQ: fixes for common problems, and short answers.