Opened 11 years ago
Closed 11 years ago
#33730 closed defect (bug) (duplicate)
ssl is not detecting for cloudflare
| Reported by: | meshr | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | 4.3 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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
@
11 years ago
- Milestone Awaiting Review
- Resolution → duplicate
- Status new → 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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
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!