strip port from HTTP_HOST

This commit is contained in:
Isaac Connor 2018-12-06 17:12:03 -05:00
parent 9ffd77428a
commit 757e538550
1 changed files with 6 additions and 1 deletions

View File

@ -52,7 +52,12 @@ class Server {
return $this->{'Name'}; return $this->{'Name'};
} }
# Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity # Use HTTP_HOST instead of SERVER_NAME here for nginx compatiblity
return $_SERVER['HTTP_HOST']; # ICON: Hi, I just met you, and this is crazy, but I need to strip port.
$host_with_port_maybe = $_SERVER['HTTP_HOST'];
$heres_my_host = preg_replace('/([^:]+)(:\d+)?/','${1}', $host_with_port_maybe);
#Just use it baby
return $heres_my_host;
} }
public function Protocol( $new = null ) { public function Protocol( $new = null ) {