[wp-trac] [WordPress Trac] #32354: is_ssl() does not work on cloud hosting
WordPress Trac
noreply at wordpress.org
Tue May 12 08:35:37 UTC 2015
#32354: is_ssl() does not work on cloud hosting
--------------------------+-----------------------------
Reporter: mdawart | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Security | Version: 4.1.1
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
On our clients cloud hosting the $_SERVER['HTTPS'] nor '443' ==
$_SERVER['SERVER_PORT'] is set so wordpress is not able to determine if
calles via https or not and activating the force ssl setting leads to a
redirect loop.
I've modified the is_ssl function to detect for environments like those:
{{{
/**
* Determine if SSL is used.
*
* @since 2.6.0
*
* @return bool True if SSL, false if not used.
*/
function is_ssl() {
if ( isset($_SERVER['HTTPS']) ) {
if ( 'on' == strtolower($_SERVER['HTTPS']) )
return true;
if ( '1' == $_SERVER['HTTPS'] )
return true;
} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' ==
$_SERVER['SERVER_PORT'] ) ) {
return true;
} elseif (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && ( 'https'
== $_SERVER['HTTP_X_FORWARDED_PROTO'] )) {
return true;
}
return false;
}
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/32354>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list