google-site-verification=wTHUUwKPLmFdHDYfbnDSDmu1cprOGh0Nnl_2cXzM0oE Skip to main content

When you installed the live website’s backup on my personal development computer using Drupal 8, you received the following problem message. The message is that the provided host name is not valid for this server.

So, this article will briefly discuss this error message you received. Also, I will discuss why this problem arises and how you can solve this problem. So, let’s discuss the error.

Reason of error

You receive the problem when you use aegir to create a subsite and see the newly created subsite. This error message may appear when you visit any page on Drupal 8. And all you see is a blank white page. 

Adding a security feature to Drupal 8 resulted in the provided host name is not valid for this server error. This error message is a result of a Drupal feature. That was included to defend against assaults on HTTP host headers. The feature is described in the change record that was created for the patch.

Sadly, it is easy to manipulate an HTTP host header for malicious purposes. And force Drupal to use a different web domain in several subsystems. As a result, you should view an HTTP host header being unreliable user input.

Solution of the problem

If you want to stop this from occurring, Drupal introduced the following feature. To specify a list of reliable domain names from which the website can run. 

Drupal studied the Symfony framework, which already included a trusted host method where website administrators could approve hostnames.

The literature specifies that this setting must consist of an array of standard expression levels. And it is indicating the hostnames you want to be able to run from, without any delimiters. 

In short, this is an added layer of defence from HTTP host header threats. The provided host name is not valid for this server threat.


If you are using the hostname to run your website, you should add the following to your settings.

 $settings[‘trusted_host_patterns’] = array(

Use the following if your starting point is

 $settings[‘trusted_host_patterns’] = array(

Your settings should resemble the following example. If you need to manage a website with numerous domains or subdomains but are not using canonical URL redirection:

$settings[‘trusted_host_patterns’] = array(

As a result, the website can be accessed through all and subdomain variations.

Related Article: importance of social media for inbound marketing

If you still see the error!

In the event that you have this setting set up. But are still receiving the provided host name is not valid for this server, an error message. Your regular expression syntax is probably incorrect. 

  • Take the first demonstration, copy it, and enter it into your settings. Then, change it to represent the hostname of the server hosting your website. 

You must be able to access your site once more after setting the correct value for the $setting.

Remove the setting 

The status report page displays an error if the setting is completely removed, disabling the trusted host mechanism. Moreover, HTTP host header assaults may be possible against your website.

Status check

The report page, located at admin/reports/status, allows you to monitor the performance of your trustworthy host settings.

Local Settings

Use the below mentioned coding if you are using the local environment development in local.settings.php

$settings[‘trusted_host_patterns’] = array(

Final verdict

In conclusion, the provided host name is not valid for this server error appears when visiting any page on Drupal 8. So, to fix this problem I will also give you a solution. By using this you can fix this error.

After doing some settings, this error will be removed. And also can remove this setting at the end. And then you can check the status.

Related Article: Google inbox email successor for android

Leave a Reply