Skip to main content

Manage the Host header when requesting a content source

Last update:

A CDN requests content from the source of the content - the server that hosts the site or files.

When requesting a content source, CDN passes the Host domain in the HTTP header so that the server can serve content from the correct domain. By default, the domain of the site from which the request came is passed.

If the content source is on a platform where one server serves multiple domains (for example, S3), you must specify the Hostname of the content source, which is the source address where the CDN will request the content. If you do not specify a Hostname, the server will not be able to determine which domain the user is requesting and will return an error.

If your server serves multiple domains, you can pass the Host header from the user.

Specify the Hostname of the content source

You cannot specify a Hostname and pass the Host header from the user at the same time.

  1. In the Control Panel, on the top menu, click Products and select CDN.

  2. In the CDN Resources section, open the resource page → Source tab.

  3. In the Hostname block specify the address of the content source - the domain name without specifying the protocol. You can add a port, for example example.com:443.

  4. Click Apply. The resource will be in PROCESSING status while the settings are being applied . You cannot apply any other settings at this time. The settings will be applied when the share changes to ACTIVE status.

  5. Check that the header value is resolved on the side of your web server where the domain content resides. If the header is not allowed, the request will return a 400 Bad Request or 403 Forbidden Response error.

    Example of a request for validation:

    $ curl -H "Host: <domain>" -I <ip_address>

    Specify:

    • <domain> - domain name without protocol, e.g. example.com;
    • <ip_address> - Source IP address with protocol, e.g. https//:192.168.1.1.

Pass Host header from user

You cannot pass the Host header from the user and specify the Hostname of the content source at the same time.

  1. In the Control Panel, on the top menu, click Products and select CDN.

  2. In the CDN Resources section, open the resource page → Source tab.

  3. In the Hostname block, check the Transmit original Host name checkbox.

  4. Click Apply. The resource will be in PROCESSING status while the settings are being applied . You cannot apply any other settings at this time. The settings will be applied when the share changes to ACTIVE status.

  5. Check that the header value is resolved on the side of your web server where the domain content resides. If the header is not allowed, the request will return a 400 Bad Request or 403 Forbidden Response error.

    Example of a request for validation:

    $ curl -H "Host: <domain>" -I <ip_address>

    Specify:

    • <domain> - domain name without protocol, e.g. example.com;
    • <ip_address> - Source IP address with protocol, e.g. https//:192.168.1.1.