Sunday, November 24, 2019

Drupal 8 - How To Resolve Trusted Host Settings Error

Drupal 8



How To Resolve Trusted Host Settings Error


While setting up the Drupal 8 website for My Man The Maker, I started to see these errors in the Administrator GUI:


This led to:
Which led to:



Which, when clicked, led to:



OK, looks like I need to figure out How To Set Up Drupal 8 Trusted Host Settings.  Well, after doing a little reading at drupal.org (thank you Drupal 8 Documentation Team!), it turned out that resolving this error turned out to be a fast and pretty easy process, for once.  All  I had to do was add some configuration information to the bottom of the settings.php file located that was located in my <drupal_root>/sites/default directory.  Just be sure to remember to register both 

- The Full (i.e. www.mymanthemaker.com

and

- The Short (i.e. mymanthemaker.com)  

versions of your website URL to avoid seeing this error:


I just added this code to the end of the setttings.php file:

#
# GL  2019-11-14  This removes the error on the Administration Screen
#                 with respect to TRUSTED HOST SETTINGS
#
$settings['trusted_host_patterns'] = [
  '^www\.mymanthemaker\.com$',
  '^mymanthemaker\.com$',
];

NOTE:  My settings.php file was read-only 

Yours should be too!

To over-write a read-only file in vi, use w! at the colon prompt, and then q to quit, like this:

:w!

Then

:q


Then, once the changes to my settings.php file were made, my Drupal 8 TRUSTED HOST SETTINGS error vanished.

Great Success!




REFERENCES:


https://www.drupal.org/docs/8/install/trusted-host-settings


No comments:

Post a Comment