This topic is locked

Undefined index: HTTP_X_FORWARDED_HOST

7/26/2024 11:02:16 AM
PHPRunner General questions
D
druck281 author

I am using Shared hosting so I don't have a ton of control right now over the server but I noticed I have been getting the red error banner at the top of the screen seemingly randomly (meaning I cannot pinpoint what is happening when it appears). When I expand it, all it says is '500 Internal Server Error. nginx/1.26.1'

img alt

I have error logging and I repeatedly see the same three entries in the log. They repeat several times per minute.

errorno:8
errstr:Undefined index: password
errfile:\output\include\appsettings.php
errline:1011

errorno:8
errstr:Undefined index: HTTP_X_FORWARDED_HOST
errfile:\output\include\commonfunctions.php
errline:5259

errorno:8
errstr: Undefined index: key
errfile:\output\connections\Connection.php
errline:306

Here is the code taken from the related errors

appsettings.php
// delete old username & password cookies
if( $_COOKIE["password"] ) { //this is line 1011
runner_setcookie("username", "", time() - 1, "", "", false, false);
runner_setcookie("password", "", time() - 1, "", "", false, false);
}
commonfunctions.php
function projectHost() {
$host = $_SERVER['HTTP_X_FORWARDED_HOST']; //this is line 5259
if( !$host )
$host = $_SERVER['HTTP_HOST'];
return $host;
}
connections.php
public static function getAutoincField($tableInfo)
{
if (!$tableInfo)
return null;

if (!is_array($tableInfo["fields"]))
return null;

$keys = array();
$autoincField = null;
foreach ($tableInfo["fields"] as $f) {
if ($f["key"]) { //this is line 306
$keys[$f["name"]] = $f["type"];

if ($f["autoInc"]) {
$autoincField = $f["name"];
break;
}
}
}

These are all functions generated by PHPRunner so I don't know what's going wrong to throw these. Everything seems to function but it making the end users nervous that there is a problem and I don't know where it's coming from. Anyone else run into something like this?

I imagine I can trap these before it presents the error message to the user but if something is actually not working, I want to track it down.

Thanks!

Admin 7/26/2024

I guess it has something to do with your web server/NGINX configuration. It sounds like variable $_SERVER['HTTP_X_FORWARDED_HOST'] is populated while it should.

Maybe ask them to disabled NGINX for your website and see what happens.