From 3a4c9f424bff7fc937334ac230217ffe5b2e246c Mon Sep 17 00:00:00 2001
From: alecpl <alec@alec.pl>
Date: Mon, 26 Jul 2010 04:54:03 -0400
Subject: [PATCH] - Support HTTP_X_FORWARDED_PROTO header for HTTPS detecting (#1486866)

---
 CHANGELOG                |    1 +
 program/include/main.inc |    4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 28abdf8..aab214b 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Support HTTP_X_FORWARDED_PROTO header for HTTPS detecting (#1486866)
 - Fix default IMAP port configuration (#1486864)
 - Create Sent folder when starting to compose a new message (#1486802)
 - Fix handling of messages with Content-Type: application/* and no filename (#1484050)
diff --git a/program/include/main.inc b/program/include/main.inc
index 8b8a7d2..ff53594 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1525,9 +1525,11 @@
 function rcube_https_check($port=null, $use_https=true)
 {
   global $RCMAIL;
-  
+
   if (!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) != 'off')
     return true;
+  if (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https')
+    return true;
   if ($port && $_SERVER['SERVER_PORT'] == $port)
     return true;
   if ($use_https && isset($RCMAIL) && $RCMAIL->config->get('use_https'))

--
Gitblit v1.9.1