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$',
'^10\.100\.3\.255$',
'^dgd8\.lndo\.site$'
];
//enable reverse proxy
$settings['reverse_proxy'] = TRUE;
//Add list allowed load balacer ip or pass respective header
$settings['reverse_proxy_addresses'] = array($_SERVER['REMOTE_ADDR']);
//make sure pass the header holding the base url
$settings['reverse_proxy_host_header'] = 'X-ORIGINAL-HOST';
reference / Credits :