missing HTTP_HOST
authorAlan <alan@roojs.com>
Wed, 2 Aug 2023 07:15:03 +0000 (15:15 +0800)
committerAlan <alan@roojs.com>
Wed, 2 Aug 2023 07:15:03 +0000 (15:15 +0800)
HTML/FlexyFramework.php

index 28bf08a..78c8274 100755 (executable)
@@ -1229,7 +1229,10 @@ RewriteRule ^(.+)$ /web.hpasite/index.local.php [L,NC,E=URL:$1]
                         $sp .= ':'.((int) $_SERVER['SERVER_PORT']);
                     }
                 }
-                $host = !empty($_SERVER["HTTP_X_FORWARDED_HOST"]) ? $_SERVER["HTTP_X_FORWARDED_HOST"] : $_SERVER["HTTP_HOST"];
+                // not sure why http host would not be set?
+                $host = !empty($_SERVER["HTTP_X_FORWARDED_HOST"]) ? $_SERVER["HTTP_X_FORWARDED_HOST"] :
+                    (!isset($_SERVER["HTTP_HOST"]) ? 'localhost' : $_SERVER["HTTP_HOST"]);
+                    
                 header('Location: '.$http.'://'.$host .$sp . $this->baseURL);
  
                 exit;