Skip to main content

Manage Host header when requesting content from the origin

Last update:

CDN requests content from the origin—a server where your website or files are hosted.

When requesting content from the origin, CDN passes the domain in the Host HTTP header so the server can serve content from the required domain. By default, the domain of the website from which the request originated is passed.

If your origin content is on a platform where one server handles multiple domains (e.g., S3), you must specify an origin Hostname the origin address used by the CDN to fetch 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 handles multiple domains, you can pass the Host header from the user.

Specify the origin Hostname

You cannot simultaneously specify a Hostname and pass the Host header from the user.

  1. In the control panel, from the top menu, click Products and select CDN.

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

  3. In the Hostname block, specify the origin address—the domain name without the protocol. You can add a port, for example, example.com:443.

  4. Click Apply. While settings are being applied, the CDN resource enters the PROCESSING status. You cannot apply other settings during this time. Settings take effect when the CDN resource transitions to ACTIVE.

  5. Ensure that the header value is allowed by your web server, where the domain content is hosted. If the header is not allowed, the request will return a 400 Bad Request or 403 Forbidden Response.

    Example request to check:

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

    Specify:

    • <domain> — domain name without the protocol, for example, example.com;
    • <ip_address> — origin IP address including the protocol, for example, https://192.168.1.1.

Pass the Host header from the user

You cannot simultaneously pass the Host header from the user and specify the origin Hostname.

  1. In the control panel, from the top menu, click Products and select CDN.

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

  3. In the Hostname block, check the Pass original Host header box.

  4. Click Apply. While settings are being applied, the CDN resource enters the PROCESSING status. You cannot apply other settings during this time. Settings take effect when the CDN resource transitions to ACTIVE.

  5. Ensure that the header value is allowed by your web server, where the domain content is hosted. If the header is not allowed, the request will return a 400 Bad Request or 403 Forbidden Response.

    Example request to check:

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

    Specify:

    • <domain> — domain name without the protocol, for example, example.com;
    • <ip_address> — origin IP address including the protocol, for example, https://192.168.1.1.