In /core/lib/Drupal/Core/DrupalKernal.php the $base_root shows incorrect value:
Line 1113 protected function initializeRequestGlobals(Request $request) { global $base_url; // Set and derived from $base_url by this function. global $base_path, $base_root; global $base_secure_url, $base_insecure_url;
// Create base URL.
$base_root = $request->getSchemeAndHttpHost();
The value the $base_root is showing is the machine name, not the requested url. Specifically, the $base_root value is like: https://machinename.windows.domain.com instead of the request url like: https://ourcompany.com
I've searched the database, exported configs, and all files in the installation for the "machinename", but the only place it exists is on the windows server as "my computer" name.
Our environment is set up with an AWS loadbalancer, AWS cert on loadbalancer, that relays traffic to the windows EC2 server.
Running very recent Apache, PHP and Drupal 8.7.14. Running updated modules using composer. I don't think this is a bug.
The problems this causes is that when there is a redirect url, or self reference, such as in the webform or workflow module, you get an error because the machinename url is not accessible externally.
I wrote code to hack DrupalKernel.php that changes the $base_root using str_replace(). Also did this to RedirectResponseSubscriber.php, which FIXES my problem. But, this is the worst kind of hack programming.
Is there a way to force symfony $request->getSchemeAndHttpHost() to give my proper url? Maybe a setting I missed?
I've been very reluctant to post this question because of the obvious criticism it can draw. I've seen a lot of "working as intended" responses around $base_url issues which don't help my case.