summaryrefslogtreecommitdiffstats
path: root/lib/private/files.php
diff options
context:
space:
mode:
authordratini0 <dratini0@gmail.com>2015-02-11 22:10:06 +0100
committerdratini0 <dratini0@gmail.com>2015-02-11 22:19:22 +0100
commit10e13b172afeb9d25f640415920fa9fab16d2375 (patch)
tree568c828ffde13a430d30aa17cfcdce517e09855d /lib/private/files.php
parentb1594ad1dfe505b3d0daf0a23993df8d8ee3d502 (diff)
downloadnextcloud-server-10e13b172afeb9d25f640415920fa9fab16d2375.tar.gz
nextcloud-server-10e13b172afeb9d25f640415920fa9fab16d2375.zip
Extending the X-accel redirect functionality with a more scalable approach.
Diffstat (limited to 'lib/private/files.php')
-rw-r--r--lib/private/files.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/private/files.php b/lib/private/files.php
index 98f3c52d6c6..3a2e291630b 100644
--- a/lib/private/files.php
+++ b/lib/private/files.php
@@ -182,7 +182,16 @@ class OC_Files {
}
if (isset($_SERVER['MOD_X_ACCEL_REDIRECT_ENABLED'])) {
- $filename = \OC::$WEBROOT . '/data' . \OC\Files\Filesystem::getRoot() . $filename;
+ if (isset($_SERVER['MOD_X_ACCEL_REDIRECT_PREFIX'])) {
+ $prefix = $_SERVER['MOD_X_ACCEL_REDIRECT_PREFIX'];
+ // nginx is picky about double slashes
+ while($prefix[strlen($prefix) - 1] === '/'){
+ $prefix = substr($prefix, 0, -1);
+ }
+ $filename = $prefix . \OC\Files\Filesystem::getLocalFile($filename);
+ } else {
+ $filename = \OC::$WEBROOT . '/data' . \OC\Files\Filesystem::getRoot() . $filename;
+ }
header("X-Accel-Redirect: " . $filename);
}
}