HappyWorld
Well-known member
File :
line 1013
When using https, on certain condition, _SERVER['HTTPS'] does not exist, even my _SERVER["SERVER_PORT"] is 80 (not 443).
I use:
Solution :
You also should consider to check _SERVER["HTTP_X_FORWARDED_PROTO"]
On https :
_SERVER["HTTP_X_FORWARDED_PROTO"] => 'https'
On http :
_SERVER["HTTP_X_FORWARDED_PROTO"] => 'http'
Solution in code :
Code:
/library/Zend/Controller/Request/Http.php
line 1013
PHP:
/**
* Get the request URI scheme
*
* @return string
*/
public function getScheme()
{
return ($this->getServer('HTTPS') == 'on') ? self::SCHEME_HTTPS : self::SCHEME_HTTP;
}
When using https, on certain condition, _SERVER['HTTPS'] does not exist, even my _SERVER["SERVER_PORT"] is 80 (not 443).
I use:
- cloudflare flexible SSL (maybe this is why 'HTTPS' does not exist').
- litespeed.
Solution :
You also should consider to check _SERVER["HTTP_X_FORWARDED_PROTO"]
On https :
_SERVER["HTTP_X_FORWARDED_PROTO"] => 'https'
On http :
_SERVER["HTTP_X_FORWARDED_PROTO"] => 'http'
Solution in code :
PHP:
/**
* Get the request URI scheme
*
* @return string
*/
public function getScheme()
{
if ($this->getServer('HTTPS') == 'on') {
return self::SCHEME_HTTPS;
}
if ($this->getServer('SERVER_PORT') == '443') {
return self::SCHEME_HTTPS;
}
if (strtolower($this->getServer('HTTP_X_FORWARDED_PROTO')) == 'https') {
return self::SCHEME_HTTPS;
}
return self::SCHEME_HTTP;
}