Score:0

How to configure trusted hosting pattern for Docker containers

de flag

From Drupal 8, if my running Docker project for Drupal is loading in my browser at...

http://docker.drupalphp:17223/

what should I put in my sites/default/settings.php file to approve the trusted_host_patterns settings?

I have tried sooooo many things, including this simple one...

$settings['trusted_host_patterns'] = array(
  '^docker\.drupalphp$',
);

But no luck on getting the trusted host pattern approved. Please help.

Here is a visual of my issue:

enter image description here

Kevin avatar
in flag
Is this the right settings file? It's not in like a local site folder?
klewis avatar
de flag
when you say a "local site folder", do you mean like a Docker volume location on my Drupal project? The project is running locally on my computer through a Docker container. Its not live on the web.
Kevin avatar
in flag
sites/(sitename)/settings.php
klewis avatar
de flag
using sites/default/settings.php
klewis avatar
de flag
It would be awesome if we could debug what the attempted settings value is, not just a see a message that says "not enabled". I feel that would solve a lot of headache.
id flag
How did you determine that `trusted_host_patterns` is the issue?
klewis avatar
de flag
I updated my post
leymannx avatar
ne flag
You don't really need this for local development. But the only things I can think of is: Flush cache. And: The file where you've set this is never included or at some later point there's an empty `$settings['trusted_host_patterns']` set again. And: Some server-side caching enabled maybe.
klewis avatar
de flag
@leymannx many thanks on all the tips provided. I will role with that for now and assume all the above.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.