Merge pull request #798 from renothing/ssl-proxy-to-http

fix error when use different protocol between reverse proxy and backend.
This commit is contained in:
joyqi
2018-10-30 10:31:17 +08:00
committed by GitHub
+3 -1
View File
@@ -237,7 +237,9 @@ class Typecho_Request
*/
public static function isSecure()
{
return (!empty($_SERVER['HTTPS']) && 'off' != strtolower($_SERVER['HTTPS']))
return (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && !strcasecmp('https', $_SERVER['HTTP_X_FORWARDED_PROTO']))
|| (!empty($_SERVER['HTTP_X_FORWARDED_PORT']) && 443 == $_SERVER['HTTP_X_FORWARDED_PORT'])
|| (!empty($_SERVER['HTTPS']) && 'off' != strtolower($_SERVER['HTTPS']))
|| (!empty($_SERVER['SERVER_PORT']) && 443 == $_SERVER['SERVER_PORT'])
|| (defined('__TYPECHO_SECURE__') && __TYPECHO_SECURE__);
}