Extending the X-accel redirect functionality with a more scalable approach.

This commit is contained in:
dratini0 2015-02-11 22:10:06 +01:00
parent b1594ad1df
commit 10e13b172a
1 changed files with 10 additions and 1 deletions

View File

@ -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);
}
}