'8443'); $s = new Server(array('Id'=>2, 'Name'=>'cam2', 'Protocol'=>'http', 'Hostname'=>'cam2.example', 'Port'=>null)); check('remote server ignores forwarded port', $s->Url(), 'http://cam2.example'); $_SERVER = array(); check('remote server ignores ZM_BASE_URL port', $s->Url(), 'http://cam2.example'); # The local single-server install still uses the request/base URL. $s = new Server(array('Id'=>0)); check('single server uses ZM_BASE_URL port', $s->Port(), 443); $_SERVER = array('HTTP_X_FORWARDED_PORT'=>'8443'); check('single server uses forwarded port', $s->Port(), '8443'); # The server handling this request has a row too in a multi-server setup; its # port still comes from the request. $s = new Server(array('Id'=>1, 'Name'=>'local', 'Protocol'=>'https', 'Hostname'=>'zm.example', 'Port'=>null)); $_SERVER = array('HTTP_X_FORWARDED_PORT'=>'8443'); check('this server uses the forwarded port', $s->Port(), '8443'); exit($failures ? 1 : 0);