diff options
author | herbrechtsmeier <stefan@herbrechtsmeier.net> | 2013-02-23 12:58:06 +0100 |
---|---|---|
committer | herbrechtsmeier <stefan@herbrechtsmeier.net> | 2013-03-09 11:00:53 +0100 |
commit | d4f98923b9be7f3e6805573085bf9fedfaff836c (patch) | |
tree | 5a9a1e615ecfc83b332cf8d8ebfe83334eb7d689 /lib | |
parent | 0629ff4dd91b488bd98c35eeff24c5fea50fc30d (diff) | |
download | nextcloud-server-d4f98923b9be7f3e6805573085bf9fedfaff836c.tar.gz nextcloud-server-d4f98923b9be7f3e6805573085bf9fedfaff836c.zip |
Overwrite host and webroot when forcessl is enabled
This patch enables the use of forcessl together with a multiple domains
reverse SSL proxy (owncloud/core#1099) which have different hostname
and webroot for http and https access. The code assumes that the ssl
proxy (https) hostname and webroot is configured via overwritehost and
overwritewebroot.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/request.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/request.php b/lib/request.php index 9f74cf9beb5..859276a12a3 100755 --- a/lib/request.php +++ b/lib/request.php @@ -11,9 +11,10 @@ class OC_Request { * @brief Check overwrite condition * @returns true/false */ - private static function isOverwriteCondition() { + private static function isOverwriteCondition($type = '') { $regex = '/' . OC_Config::getValue('overwritecondaddr', '') . '/'; - return $regex === '//' or preg_match($regex, $_SERVER['REMOTE_ADDR']) === 1; + return $regex === '//' or preg_match($regex, $_SERVER['REMOTE_ADDR']) === 1 + or ($type <> 'protocol' and OC_Config::getValue('forcessl', false)); } /** @@ -52,7 +53,7 @@ class OC_Request { * Returns the server protocol. It respects reverse proxy servers and load balancers */ public static function serverProtocol() { - if(OC_Config::getValue('overwriteprotocol', '')<>'' and self::isOverwriteCondition()) { + if(OC_Config::getValue('overwriteprotocol', '')<>'' and self::isOverwriteCondition('protocol')) { return OC_Config::getValue('overwriteprotocol'); } if (isset($_SERVER['HTTP_X_FORWARDED_PROTO'])) { |