All Products
Search
Document Center

CDN:Accelerate web portal through CDN

Last Updated:Feb 14, 2025

This topic walks you through how to use Alibaba Cloud Content Delivery Network (CDN) to accelerate the storage of Image and Small File in OSS.

Introduction

Common web portals mainly display static resources such as images, text, and videos. If your website resources are small images and files, set Business Type to Image and Small File. If your website has a large number of audio and video resources, select VOD. In this example, we use testcdn.top.

Benefits

Use the Alibaba Cloud ARMS monitoring tool to test the OSS resource URL and CDN accelerated domain name. The result is as follows:

Note

The result of each test may be different due to network.

image

Based on the above data, it can be accelerated by about 35% by connecting to CDN.

Prerequisites

Add a domain name

  1. Log on to the CDN console.

  2. In the left-side navigation pane, click Domain Names.

  3. On the Domain Names page, click Add Domain Name.

  4. In the Add Domain Name dialog box, set the following items:

    • Region: Global (Excluding the Chinese Mainland)

    • Domain Name: images.testcdn.top

    • Business Type: Image and Small File

    • Resource Group: Default Resource Group

    Important

    The first time you add a domain name to CDN, you must verify the its ownership. For more information, see Verify the ownership of a domain name.

  5. Click Add Origin Sever. Set the following items:

    • Origin Info: OSS Domain

    • Domain Name: select your bucket domain name

    • Priority: Primary

    • Weight: 10

    • Port: 80

  6. Read the Compliance Warranty Regarding Cross-border Data Transfers notice, select I have read and agree to the preceding compliance commitment. Click Next, and then click Back to Domain Management.

Add a CNAME record for a domain name

  1. On the Domain Names page, find the domain name that you added and copy the value in the CNAME field.

  2. Move the pointer over the left-side navigation pane of Alibaba Cloud to search for Products and Services. Enter DNS in the search box.

  3. In the Enterprise Services & Cloud Communication section of the search results, click Alibaba Cloud DNS.

  4. On the Authoritative DNS Resolution page, find the domain name that you want to manage and click DNS Settings in the Actions column.

  5. On the DNS Settings tab, click Add DNS Record. Set Type to CNAME, Host Record to images, Request Source to Default, Value to the CNAME that you copied in Step 1, and TTL 10 Minutes (recommend).

Troubleshooting

  • Issue

After you add an accelerated domain name and configure a CNAME record, you can directly access the acceleration resource 403.

image

  • Solution

This issue occurs because public read is not enabled for private OSS resources. For safety, the following operations are recommended.

  1. On the CDN console, go to Domain Names page, find images.testcdn.top and click Manage.

  2. On the CDN Domain Names page, click Origin Fetch. Turn on Status for Alibaba Cloud OSS Private Bucket Access. Select Bucket in the Same Account.

  3. Verify the access.

    image