[wp-trac] [WordPress Trac] #40710: Improvement ssl detection
WordPress Trac
noreply at wordpress.org
Wed May 10 08:47:17 UTC 2017
#40710: Improvement ssl detection
----------------------------+-----------------------------
Reporter: lriaudel | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Bootstrap/Load | Version: 4.7.4
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
In some case, is_ssl() don't work fine : For HTTP_X_FORWARDED_PROTO.
exemple :
[https://forums.ouvaton.coop/t/https-et-port-443-avec-wordpress/1074/3]
Here a proposition :
{{{#!php
<?php
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/40710>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list