Manage Host header when requesting content from the origin
CDN requests content from the origin—a server where your website or files are hosted.
When requesting the content source, CDN passes the domain in the Host HTTP header so that the server can return content from the required domain. By default, the domain of the website from which the request came is passed.
If the content source is located on a platform where one server serves multiple domains (for example, S3), you must specify the Hostname of the content source — the address of the source that CDN will query for content. If you do not specify the 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 forward the Host header from the user.
Specify the origin Hostname
You cannot simultaneously specify a Hostname and forward the Host header from the user.
-
In the control panel, in the top menu, click Products and select CDN.
-
In the CDN resources section, open the CDN resource page → Source tab.
-
In the Hostname section, specify the content source address — domain name without specifying the protocol. You can add a port, for example
example.com:443. -
Click Apply. While the settings are being applied, the CDN resource will be in the
PROCESSINGstatus. During this time, applying other settings is unavailable. The settings will take effect when the CDN resource changes to theACTIVEstatus. -
Make sure that the header value is allowed by your web server where the domain content is located. If the header is not allowed, the request will return a
400 Bad Requestor403 Forbidden Responseerror.Example request to check:
$ curl -H "Host: <domain>" -I <ip_address>Specify:
<domain>— domain name without specifying the protocol, for exampleexample.com;<ip_address>— IP address of the source with the protocol specified, for examplehttps//:192.168.1.1.
Pass the Host header from the user
You cannot simultaneously forward the Host header from the user and specify the content source Hostname.
-
In the control panel, in the top menu, click Products and select CDN.
-
In the CDN resources section, open the CDN resource page → Source tab.
-
In the Hostname section, select the Forward original Host header checkbox.
-
Click Apply. While the settings are being applied, the CDN resource will be in the
PROCESSINGstatus. During this time, applying other settings is unavailable. The settings will take effect when the CDN resource changes to theACTIVEstatus. -
Make sure that the header value is allowed by your web server where the domain content is located. If the header is not allowed, the request will return a
400 Bad Requestor403 Forbidden Responseerror.Example request to check:
$ curl -H "Host: <domain>" -I <ip_address>Specify:
<domain>— domain name without specifying the protocol, for exampleexample.com;<ip_address>— IP address of the source with the protocol specified, for examplehttps//:192.168.1.1.