[wp-trac] [WordPress Trac] #33730: ssl is not detecting for cloudflare

WordPress Trac noreply at wordpress.org
Fri Sep 4 15:10:26 UTC 2015


#33730: ssl is not detecting for cloudflare
--------------------------+-----------------------------
 Reporter:  meshr         |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.3
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 My blog is behind cloudflare and if i use https to access it then it
 doesn't display properly because is_ssl() function doesn’t detect https. I
 added {{{$_SERVER['HTTP_X_FORWARDED_PROTO']}}} variable check and it works
 now properly. Here is a fix for is_ssl()  in my wp-includes/functions.php:


 {{{
 function is_ssl() {
         if ( isset($_SERVER['HTTPS']) ) {
                 if ( 'off' !== 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/33730>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list