API
The Gcore Customer Portal is being updated. Screenshots may not show the current version.
CDN
CDN
BillingCDN resources overviewOrigin groupPurgePrefetchReports
API
Chosen image
Home/CDN/CDN resource options/HTTP headers/Manage the Host header

Configure and check the Host header

What is the Host header?

The Host header is the mandatory header of HTTP requests. CDN servers send it to the origin when they request content. The Host header helps determine which website or web application, out of all those stored on the server, contains the requested content.

The Change Host header option controls the Host header. It is automatically enabled and populated when you create a CDN resource and specify the origin’s domain name/IP address or select a group of origins. In the latter case, the domain name or IP address of the first resource in the group will be used as the Host header.

For example, let’s create a CDN resource and specify yourdomain.com in the Origin section as follows:

What is the Host header

This value will appear at the "Change Host header" option as follows:

Change Host heade

How to manage the Host header

If you change the origin source after resource creation, the Host header value will not be changed automatically. You will need to manually change it. If the value is not corrected, the CDN resource will refer to the new source using the old Host header, resulting in an error for end users instead of content.

1. Open the Resource settings in the Gcore Customer Portal.

Resource settings in the control panel

2. Go to the HTTP headers section and select the Host header option.

3. Configure the option. There are two ways to set it up:

  • Custom Host header option: Select this if you use only one origin source, and specify the domain or IP address.
  • Forward Host header: select this if it is important to send the same Host header in the request to the origin as was sent in the request to the CDN server.

4. Save your changes.

Don’t forget to clear the CDN cache afterwards.

How to disable the Change Host header option

In most cases, end users will get 4xx or 5xx errors if the Change Host header option is disabled. To avoid this, you should enable the option and set the appropriate value.

If you are using a default CDN resource (*.gvideo.io) for streaming, the Host header will take the value of the CNAME of the CDN resource. This is the value that the option will take as soon as it is disabled.

How to disable the Change Host header option

How to check the Host header

To check if the Host header used is correct, run the following command in the terminal (Windows) or console (macOS):

curl -H "Host: example.com" -I http(s)://10.0.0.1/file.txt

Where:

  • example.com is the value of the Host header;
  • http(s) is the protocol value, which depends on the protocol used by the source;
  • 10.0.0.1 is the IP address of your website source; and
  • file.txt is any static file that is delivered via CDN.

If you receive a 400 Bad Request or 403 Forbidden Response error in the response, your server is unable to process the specified Host header. In this case, follow the instructions above to manage the option.

Was this article helpful?

Not a Gcore user yet?

Learn more about our next-gen CDN

Go to the product page