[opw-web] class_core.php: Support HTTP_X_FORWARDED_PROTO for get_protocol



commit bdb37992e48cd5374b0ba2d28616f00e9d942c90
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Tue Mar 18 23:30:12 2014 -0400

    class_core.php: Support HTTP_X_FORWARDED_PROTO for get_protocol
    
    Look at HTTP_X_FORWARDED_PROTO in additions to HTTPS to see if
    the protocol should be https.

 classes/class_core.php |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/classes/class_core.php b/classes/class_core.php
index 07df629..12ea72a 100644
--- a/classes/class_core.php
+++ b/classes/class_core.php
@@ -125,7 +125,11 @@ class core
     // Returns the current protocol
     function get_protocol()
     {
-        return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
+        if ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ||
+            (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https'))
+            return 'https://';
+        else
+            return 'http://';
     }
 
     // Method to replace square brackets with normal braces


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]