diff --git a/web/includes/Server.php b/web/includes/Server.php index d254227ca..e8402809c 100644 --- a/web/includes/Server.php +++ b/web/includes/Server.php @@ -34,7 +34,11 @@ class Server { } public function Url() { - return ZM_BASE_PROTOCOL . '://'. $this->Hostname(); + if ( $this->Id() ) { + return ZM_BASE_PROTOCOL . '://'. $this->Hostname(); + } else { + return ''; + } } public function Hostname() { if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) { diff --git a/web/includes/functions.php b/web/includes/functions.php index e14eb369d..30b183385 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -99,6 +99,11 @@ function CORSHeaders() { # The following is left for future reference/use. $valid = false; + $servers = dbFetchAll( 'SELECT * FROM Servers' ); + if ( sizeof($servers) <= 1 ) { + # Only need CORSHeaders in the event that there are multiple servers in use. + return; + } foreach( dbFetchAll( 'SELECT * FROM Servers' ) as $row ) { $Server = new Server( $row ); if ( $_SERVER['HTTP_ORIGIN'] == $Server->Url() ) {