All Products
Search
Document Center

CDN:Configure the default origin host

Last Updated:Feb 28, 2026

The default origin host controls the Host header in back-to-origin requests from Alibaba Cloud CDN edge nodes to your origin server. By default, CDN sets the Host header to the accelerated domain name. Override this default when your origin server uses virtual hosting to serve multiple websites from a single server.

Important

Your origin server must support matching virtual websites based on the Host header value. Otherwise, this feature does not work as expected.

How the origin host works

When a CDN edge node fetches content from your origin server, it includes a Host header in the HTTP request. The origin server uses this Host header to determine which website or application should handle the request.

Virtual hosting allows a single web server to host multiple websites, distinguished by the Host header value. For example, if you have multiple accelerated domain names that each accelerate different static resources, virtual hosting lets you consolidate them onto a single origin server instead of maintaining separate servers for each domain.

image

The following figure shows how virtual hosting works with multiple websites on one server.

image

NGINX example

NGINX implements virtual hosting through server blocks. Each block uses the server_name directive to match the Host header value from incoming requests:

server {
    listen      80;
    server_name example.org www.example.org;
    ...
}

server {
    listen      80;
    server_name example.net www.example.net;
    ...
}

server {
    listen      80;
    server_name example.com www.example.com;
    ...
}

In this configuration, three virtual websites are defined: example.org, example.net, and example.com. NGINX uses the server_name and the Host header value from the HTTP request to determine which virtual website to serve. If no virtual website matches, NGINX uses the default one. If no default is configured, the first server block is used.

When you access a URL without specifying the Host header, the Host header value defaults to the host and port in the URL. However, Alibaba Cloud CDN sets the Host header to the accelerated domain name by default. The default origin host feature lets you override this value, which is essential when your origin server uses virtual hosting.

Choose a domain type

The Domain Type parameter determines the Host header value in back-to-origin requests. Choose based on your origin server setup:

Domain typeHost header valueWhen to use
CDN DomainThe accelerated domain name that users visit.Your origin server hosts a virtual site that matches the accelerated domain name.
Origin DomainThe domain name of the origin server.Your origin server uses its own domain name to identify content, or you use an OSS bucket as the origin.
Custom DomainA domain name that you specify.Your origin server is associated with multiple domain names and you want to direct requests to a specific one.
Note
  • If the origin server type is set to IP when you add an origin server, Origin Domain is dimmed and unavailable.

  • If the origin server type is set to OSS Domain when you add an origin server, Origin Host is automatically turned on and the Domain Type parameter is set to Origin Domain.

  • When you select Custom Domain, make sure the custom domain name is associated with the origin server. Otherwise, origin fetch fails.

Procedure

  1. Log on to the CDN console.

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

  3. On the Domain Names page, find the target domain name and click Manage in the Actions column.

  4. In the domain's navigation pane, click Origin Fetch.

  5. In the Default Origin Host section, click Modify.

  6. Turn on Origin Host and configure the Domain Type parameter.

    Back-to-origin configuration

  7. Click OK.

Examples

Origin server address is a domain name

  • Accelerated domain name: image.example.com

  • Origin server address: source.example.com

By default, the origin host feature is disabled. After you enable it, the Domain Type options work as follows:

Domain typeBehavior
CDN DomainCDN sends back-to-origin requests with the Host header set to image.example.com, directing them to the virtual site image.example.com on the origin server source.example.com.
Origin DomainCDN sends back-to-origin requests with the Host header set to source.example.com, directing them to the origin server source.example.com.
Custom DomainCDN sends back-to-origin requests with the Host header set to the custom domain name that you specify.

Origin server address is an IP address

  • Accelerated domain name: example.com

  • Origin server address: 10.10.10.10

By default, the origin host feature is disabled. After you enable it, the Domain Type options work as follows:

Domain typeBehavior
CDN DomainCDN sends back-to-origin requests with the Host header set to example.com, directing them to the virtual site example.com on the origin server 10.10.10.10.
Origin DomainDimmed and unavailable because the origin server type is IP.
Custom DomainCDN sends back-to-origin requests with the Host header set to the custom domain name, directing them to the corresponding virtual site on 10.10.10.10.

Origin server address is an OSS domain name

  • Accelerated domain name: example.com

  • Origin server address: example.oss-cn-hangzhou.aliyuncs.com

When the origin server is an OSS domain name, CDN automatically enables Origin Host and sets the Domain Type to Origin Domain. The options work as follows:

Domain typeBehavior
CDN DomainCDN sends back-to-origin requests with the Host header set to example.com to the origin server example.oss-cn-hangzhou.aliyuncs.com.
Origin DomainCDN sends back-to-origin requests with the Host header set to example.oss-cn-hangzhou.aliyuncs.com, directing them to the origin server.
Custom DomainCDN sends back-to-origin requests with the Host header set to the custom domain name to the origin server example.oss-cn-hangzhou.aliyuncs.com.