59 $protocol = $this->
getHeader(
'X_FORWARDED_PROTO');
69 return (
string)$this->
getServerVar(
'SERVER_PORT') ===
'443';
81 $protocol = strtolower((
string)$protocol);
83 return in_array($protocol, [
'on',
'1',
'https',
'ssl'],
true);
98 $header = $this->
getHeader(
'X_FORWARDED_HOST');
100 $elements = explode(
',', $header);
101 $host = $elements[count($elements) - 1];
102 } elseif (!$host = $this->
getHeader(
'HOST')) {
110 $host = strtolower(preg_replace(
'/:\d+$/',
'', trim($host)));
115 $appendPort =
':' . $port;
118 if (($scheme ==
'http' && $port ==
'80') || ($scheme ==
'https' && $port ==
'443')) {
122 return $host . $appendPort;
128 $port = $this->
getHeader(
'X_FORWARDED_PORT');
130 return (
string)$port;
133 $protocol = (string)$this->
getHeader(
'X_FORWARDED_PROTO');
134 if ($protocol ===
'https') {
150 return isset($_SERVER[$key]) ? $_SERVER[$key] :
'';
175 $elements = explode(
',', $header);
176 $host = $elements[count($elements) - 1];
178 return preg_match(
"/^([a-z\d](-*[a-z\d])*)(\.([a-z\d](-*[a-z\d])*))*$/i", $host)
179 && 0 < strlen($host) && strlen($host) < 254
180 && preg_match(
"/^[^\.]{1,63}(\.[^\.]{1,63})*$/", $host);