Skip to content

Commit

Permalink
fix error when use different protocol between reverse proxy and backend.
Browse files Browse the repository at this point in the history
  • Loading branch information
renothing committed Oct 27, 2018
1 parent 235888c commit 1e7e7e7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion var/Typecho/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,9 @@ public static function getUrlPrefix()
*/
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__);
}
Expand Down

0 comments on commit 1e7e7e7

Please sign in to comment.