How to fix ‘Trusted Host Settings Not enabled’ error in Drupal 8
After installing Drupal 8, you might get an error in status report page such as ‘Trusted Host Settings – Not enabled’. Its shown in the image below:-
You are getting this error since latest version of Drupal wants to make sure that the website is getting incoming requests from trusted hosts only. If we failed to configure this settings, the website can be lead into security vulnerabilities. To avoid such security issues, you should fix the issue as given below:-
1) Go to root folder of your website and edit ‘settings.php’ configuration file in the location ‘sites/default/’
2) Make sure that settings.php file is writable since its ‘read-only’ by default due to security reasons.
3) Add the following code into settings.php and change the domain name to match your website’s domain.
$settings['trusted_host_patterns'] = array( '^www\.glonius\.com$', );
4) Save ‘settings.php’ configuration file and you’re done!
(Recommended: Drupal 8 Explained: Your Step-by-Step Guide to Drupal 8)
Now if you go to status report page (/admin/reports/status), you might notice that the ‘trusted host settings’ error is disappeared. That’s all. Now your website is safe to be online 🙂
Please remember to change ‘settings.php’ permissions back to read-only. You can contact me here if you have any questions!