All Products
Search
Document Center

Edge Security Acceleration:Origin host

Last Updated:Sep 19, 2024

By default, the domain name in a client request is used as the Host request header when Dynamic Content Delivery Network (DCDN) requests resources from the origin server. If you configure an origin domain that is different from the requested domain name, you need to modify the origin host to ensure that origin fetch requests go to the correct origin.

Important

Your origin server must allow virtual host matching by the Host request header. Otherwise, the origin host setting does not work as expected.

Background information

Origin host

When a DCDN POP requests resources from the origin server, the requested domain name is used as the Host request header by default.

image

The origin server returns the requested resources based on the Host header such as www.example.com carried in origin fetch requests. If multiple websites are hosted on your origin server by using virtual hosting, the origin server verifies the Host header and website name in origin fetch requests to ensure that the desired resources are returned. You can modify the Host request header in origin fetch requests based on your origin settings to ensure that the desired resources are returned.

Virtual hosting

Virtual hosting allows you to host multiple websites on a single web server. A server distinguishes and isolates different websites by domain name or hostname. When a user accesses a specific domain name or hostname, the server directs the request to the corresponding virtual host based on the domain name or hostname in the request to retrieve the required content.

Example of virtual hosts on an NGINX server

An NGINX server supports the configuration of multiple virtual hosts by using the server block. In this example, the following virtual hosts are configured on an NGINX server: www.example.org, www.example.net, and www.example.com.

The NGINX server first checks the Host header in an HTTP request to determine the virtual host to which the HTTP request needs to be routed. If no matching virtual host is found, the NGINX server uses the default virtual host to provide services. If no default virtual host is configured, the first virtual host specified by using the server block is used by default.

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;
    ...
}

Example:

image

Create an origin host rule

  1. Log on to the ESA console.

  2. In the left-side navigation pane, click Websites.

  3. On the Websites page, find the website that you want to manage, and click the website name or View Details in the Actions column.

  4. In the left-side navigation tree, choose Rules > Origin Rules.

  5. Click Create Rule and enter a rule name in the Rule Name field.

  6. In the If requests match... section, specify a custom filter expression that you want to use to match user requests and click Configure in the Origin Host section. Then, enter an origin host in the text box.

  7. Click OK.