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:
This value will appear at the "Change Host header" option as follows:
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.
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:
4. Save your changes.
Don’t forget to clear the CDN cache afterwards.
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.
To check if the Host header used is correct, run the following command in the terminal (Windows) or console (macOS):
Where:
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?
Learn more about our next-gen CDN