MDL-84313 pluginfile: Allow fetching by chunks in cross-site requests

Without these headers, the range headers are blocked so only the first chunk of the file can be retrieved.
This commit is contained in:
Dani Palou
2025-01-23 15:54:18 +01:00
parent ddc7c93a3c
commit 1a3e762198
2 changed files with 4 additions and 0 deletions
+2
View File
@@ -33,6 +33,8 @@ require_once('config.php');
// Allow CORS requests.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: range');
header('Access-Control-Expose-Headers: Content-Range');
$relativepath = get_file_argument();
$token = optional_param('token', '', PARAM_ALPHANUM);
+2
View File
@@ -40,6 +40,8 @@ require_once($CFG->dirroot . '/webservice/lib.php');
// Allow CORS requests.
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Headers: range');
header('Access-Control-Expose-Headers: Content-Range');
// Authenticate the user.
$token = required_param('token', PARAM_ALPHANUM);