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:52:35 +01:00
parent e6c92dc291
commit 53e2e59432
2 changed files with 4 additions and 0 deletions

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

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