diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-03-31 15:30:44 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-03-31 15:36:48 +0200 |
commit | cf361b6b4afe76e3bb6295a1fdd80d5ad0badd65 (patch) | |
tree | 16b5c3eeac62a2569642dc669fa9cbbeb8c7fb54 | |
parent | 65e3f634000a2142f412b85d0443f241bb64a9ab (diff) | |
download | nextcloud-server-cf361b6b4afe76e3bb6295a1fdd80d5ad0badd65.tar.gz nextcloud-server-cf361b6b4afe76e3bb6295a1fdd80d5ad0badd65.zip |
Allow using "/" in "overwritewebroot"
Whenever the reverse proxy is using "/" as the webroot, it is now
possible to set that value in "overwritewebroot"
-rwxr-xr-x | config/config.sample.php | 2 | ||||
-rwxr-xr-x | lib/private/request.php | 5 |
2 files changed, 4 insertions, 3 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index 140b75706ea..adcc175e2fa 100755 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -41,7 +41,7 @@ $CONFIG = array( /* The automatic protocol detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the protocol detection. For example "https" */ "overwriteprotocol" => "", -/* The automatic webroot detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the automatic detection. For example "/domain.tld/ownCloud" */ +/* The automatic webroot detection of ownCloud can fail in certain reverse proxy situations. This option allows to manually override the automatic detection. For example "/domain.tld/ownCloud". The value "/" can be used to remove the root. */ "overwritewebroot" => "", /* The automatic detection of ownCloud can fail in certain reverse proxy situations. This option allows to define a manually override condition as regular expression for the remote ip address. For example "^10\.0\.0\.[1-3]$" */ diff --git a/lib/private/request.php b/lib/private/request.php index 8041c4f0048..7cbbb0676b1 100755 --- a/lib/private/request.php +++ b/lib/private/request.php @@ -166,10 +166,11 @@ class OC_Request { */ public static function scriptName() { $name = $_SERVER['SCRIPT_NAME']; - if (OC_Config::getValue('overwritewebroot', '') !== '' and self::isOverwriteCondition()) { + $overwriteWebRoot = OC_Config::getValue('overwritewebroot', ''); + if ($overwriteWebRoot !== '' and self::isOverwriteCondition()) { $serverroot = str_replace("\\", '/', substr(__DIR__, 0, -strlen('lib/private/'))); $suburi = str_replace("\\", "/", substr(realpath($_SERVER["SCRIPT_FILENAME"]), strlen($serverroot))); - $name = OC_Config::getValue('overwritewebroot', '') . $suburi; + $name = '/' . ltrim($overwriteWebRoot . $suburi, '/'); } return $name; } |