I installed Drupal 8.0.0.0 on Ubuntu 14.04
In the Status Report I got next message : "Trusted Host Settings Not enabled"
According to instructions I found, I added next code into settings.php :
@code
$settings['trusted_host_patterns'] = array(
'^localhost$',
);
@endcode
But the report warning message remains.

What can I do?

Comments

VM’s picture

The setting in question is not related to installation. Please edit the opening post and move it to the 'post installation' forum. Thank you.

Elis@_forlgbtkampene’s picture

Did u try to log off/in and restart (Apache) server (or maybe clearing cache also) ?
From my experiences, some new settings don't work if I don't those mentioned actions.
Maybe, it'll help you also.

jjgw’s picture

stop/restart apache2 does not help and caching is not enabled.
So there must be another reason.

Elis@_forlgbtkampene’s picture

jjgw’s picture

It's working now after inserting in settings.php :

$settings['trusted_host_patterns'] = array(
'^localhost$',
);

without @code/@endcode tags as I did before (I'am newbe with php!)

Thanks for helping me.

halfMackerel’s picture

I tried that and it doesn't work for me. I work with acquia (local development) but i don't know if that's a problem. I always get the following message: "The provided host name is not valid for this server."

I don't know what else i can do :(

TheMossy’s picture

Hi,

I'm working with Acquia dev desktop locally (on windows) and found the Acquia adds its own domain name locally with - sitename:dd
sitename being the name you called your site when creating it. So the code in the settings.php file would be -

$settings['trusted_host_patterns'] = array(
'^sitename.dd$',
);

This worked for me. You may need to stop and start Apache.

halfMackerel’s picture

Thank you very much!!!! Finally it worked!

Mistah7’s picture

$settings['trusted_host_patterns'] = array(
'^sitename.dd$',
);

Worked for me too!

Thank!

mmjvb’s picture

the pattern should escape the meaning of . to take it literally!

'^sitename.dd$',

should be '^sitename\.dd$',

You want running restricted to sitename.dd and not allow sitenameadd ... sitenamezdd

FreeXenon’s picture

error when trying to install core and external modules

$settings['trusted_host_patterns'] = array(
'^localhost$',
'^192\.168\.0\.22$',
'^127\.0\.0\.1$',
);

Have stopped and started XAMPP and cleared the cache - no change.
This is ridiculous! =(

rahul_sankrit’s picture

This is working for me :

$settings['trusted_host_patterns'] = array(
'^localhost$',
'^192\.168\.53\.222$',
'^127\.0\.0\.1$',
);

Thanks

kn2’s picture

I move the code out of the comment block (comment block start with /** , end with */)

kuhan’s picture

Thanks it's work for me.

I move the code end of the settings.php file, it work's fine,it might suitable for all drupal versions because so much of comment blocks (comment block start with /**, end with */) are there in the settings.php file.

dhmichael’s picture

Put the settings configuration

$settings['trusted_host_patterns'] = array(

'^localhost$',

'^localhost\.*',
);

before 
/**

* Trusted host configuration. then it will work