If the environment is using load balancer or reverse proxy / keubernates pod / cloudflare your reading the right gist
As drupal as has removed hard coding the base url from the settings.php
add followig in settings.php
// add trusted patterns
$settings['trusted_host_patterns'] = [
'^dg8\.test\.dev$',