]> source.dussan.org Git - nextcloud-server.git/commitdiff
Allow using "/" in "overwritewebroot"
authorVincent Petry <pvince81@owncloud.com>
Mon, 31 Mar 2014 13:30:44 +0000 (15:30 +0200)
committerVincent Petry <pvince81@owncloud.com>
Mon, 31 Mar 2014 13:36:48 +0000 (15:36 +0200)
Whenever the reverse proxy is using "/" as the webroot, it is now
possible to set that value in "overwritewebroot"

config/config.sample.php
lib/private/request.php

index 140b75706ea59e016281a6cbb0faccd097039f06..adcc175e2fae886746d80100523c33db232d115f 100755 (executable)
@@ -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]$" */
index 8041c4f004867241b019529be34e56ef84b5b75c..7cbbb0676b17b7e1c4816fa2cc6318b4ec92e0f4 100755 (executable)
@@ -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;
        }