support for forwarded proto/port in Server.php (#2343)
parent
882c4e2ea6
commit
567b60ffa7
web/includes
|
@ -62,7 +62,12 @@ class Server {
|
||||||
if ( isset($this->{'Protocol'}) and ( $this->{'Protocol'} != '' ) ) {
|
if ( isset($this->{'Protocol'}) and ( $this->{'Protocol'} != '' ) ) {
|
||||||
return $this->{'Protocol'};
|
return $this->{'Protocol'};
|
||||||
}
|
}
|
||||||
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? 'https' : 'http';
|
|
||||||
|
return (
|
||||||
|
( isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' )
|
||||||
|
or
|
||||||
|
( isset($_SERVER['HTTP_X_FORWARDED_PROTO']) and ( $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) )
|
||||||
|
) ? 'https' : 'http';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Port( $new = '' ) {
|
public function Port( $new = '' ) {
|
||||||
|
@ -72,6 +77,11 @@ class Server {
|
||||||
if ( isset($this->{'Port'}) and $this->{'Port'} ) {
|
if ( isset($this->{'Port'}) and $this->{'Port'} ) {
|
||||||
return $this->{'Port'};
|
return $this->{'Port'};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( isset($_SERVER['HTTP_X_FORWARDED_PORT']) ) {
|
||||||
|
return $_SERVER['HTTP_X_FORWARDED_PORT'];
|
||||||
|
}
|
||||||
|
|
||||||
return $_SERVER['SERVER_PORT'];
|
return $_SERVER['SERVER_PORT'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue