Opened 9 years ago
Closed 9 years ago
#33730 closed defect (bug) (duplicate)
ssl is not detecting for cloudflare
Reported by: | meshr | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3 |
Component: | General | Keywords: | |
Focuses: | Cc: |
Description
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; }
Attachments (1)
Change History (3)
#2
@
9 years ago
- Milestone Awaiting Review deleted
- Resolution set to duplicate
- Status changed from new to closed
Duplicate of #31288.
Thanks for the report, meshr. This is something that comes up often, but is not something that will be fixed due to the nature of client-provided headers. See here for more info.
Note: See
TracTickets for help on using
tickets.
You'll need to submit a .patch/.diff file for it to be considered for core. :)
Have a read over this handbook: http://make.wordpress.org/core/handbook/
Welcome to Trac!