When installing drupal 8, or moving to production one could see this error. The fix is extremely simple. 

This was a setting that was added to drupal 8 as a security measure. Long story short, this is an extra protection against http host header attacks.

Look for the $settings['trugsted_host_pattersn'] array in your settings file and uncomment if necessary. Next, add (all) your domains to the array. For example:

$settings['trusted_host_patterns'] = array(
  '^stefvanlooveren\.me$',
  '^.+\.stefvanlooveren\.me$', // also add subdomains like www.st...
);

Save this, and your error will disappear. Moreover, your site is much more secure now!

More info about Trusted Host settings


Saved you some valuable time?

Donate and get more free time-saving code on this website in the future.