Fix ssl checker for load balancers

This commit is contained in:
jonfalcon
2016-01-13 15:41:52 -08:00
parent 90f3a4b9b6
commit 67635132b4
+7 -1
View File
@@ -96,7 +96,13 @@ class UM_Files {
$this->upload_basedir = apply_filters('um_upload_basedir_filter', $this->upload_basedir );
$this->upload_baseurl = apply_filters('um_upload_baseurl_filter', $this->upload_baseurl );
if( is_ssl() ){
// @note : is_ssl() doesn't work properly for some sites running with load balancers
// Check the links for more info about this bug
// https://codex.wordpress.org/Function_Reference/is_ssl
// http://snippets.webaware.com.au/snippets/wordpress-is_ssl-doesnt-work-behind-some-load-balancers/
if( is_ssl() || stripos( get_option( 'siteurl' ), 'https://' ) !== false
|| ( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] )
&& $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https' ) ) {
$this->upload_baseurl = str_replace("http://", "https://", $this->upload_baseurl);
}