[opw-web] Add config variable to force on HTTP_X_FORWARDED_PROTO=https



commit 645486c0a02ee318828119c11f031d4700242b7e
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Mar 10 13:52:03 2014 -0400

    Add config variable to force on HTTP_X_FORWARDED_PROTO=https
    
    The forwarded protocol doesn't seem to be set in the GNOME environment;
    add a config variable to allow forcing it on.

 classes/class_config.php |    2 ++
 config.sample.php        |    5 +++++
 init.php                 |    3 +++
 3 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/classes/class_config.php b/classes/class_config.php
index 8438547..c4ebb0d 100644
--- a/classes/class_config.php
+++ b/classes/class_config.php
@@ -33,6 +33,7 @@ class config
 
     var $webmaster;
     var $http_host;
+    var $https_force_forwarded_proto;
     var $skin_name;
     var $lang_name;
     var $per_page;
@@ -115,6 +116,7 @@ class config
             $this->site_copyright   = isset($site_copyright) ? $site_copyright : '&copy; 2012 KDE';
             $this->webmaster        = isset($webmaster) ? $webmaster : '';
             $this->http_host        = isset($http_host) ? $http_host : '';
+            $this->https_force_forwarded_proto = isset($https_force_forwarded_proto) ? 
$https_force_forwarded_proto : '';
             $this->skin_name        = isset($skin_name) ? $skin_name : 'Neverland';
             $this->lang_name        = isset($lang_name) ? $lang_name : 'en-gb';
             $this->per_page         = isset($per_page) ? $per_page : 10;
diff --git a/config.sample.php b/config.sample.php
index e33ae31..cf3c599 100644
--- a/config.sample.php
+++ b/config.sample.php
@@ -60,6 +60,11 @@ $site_copyright = "&copy; KDE Webteam and GNOME Foundation";
 // Webmaster's email address
 $webmaster = "webmaster gnome org";
 
+// If set, this causes the HTTP_X_FORWARDED_PROTO server variable to be set
+// to 'https' in the server environment; this is basically a workaround for
+// some config problem with the GNOME setup.
+$https_force_forwarded_proto = false;
+
 // Name of current skin
 $skin_name = "Neverland";
 
diff --git a/init.php b/init.php
index ac68bba..d854b2c 100644
--- a/init.php
+++ b/init.php
@@ -35,6 +35,9 @@ include_once('classes/class_donut.php');
 $config = new config();
 $gsod = new gsod();
 
+if ($config->https_force_forwarded_proto)
+  $_SERVER['HTTP_X_FORWARDED_PROTO'] = 'https';
+
 // Instantiate general classes
 $core   = new core();
 $db     = new db();


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