Add CORS headers for JSON output of index / overview
This commit is contained in:
parent
e423668d93
commit
36493ff072
@ -35,6 +35,12 @@ $fieldsGetter = new CsvxmlAvailableFields($lang);
|
||||
$availableFields = $fieldsGetter->getFields();
|
||||
|
||||
if ($outFormat === 'json') {
|
||||
header('Cache-Control: no-cache, no-store, must-revalidate, max-age=0'); // HTTP/1.1
|
||||
header('Pragma: no-cache'); // HTTP/1.0
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: GET");
|
||||
header("Access-Control-Allow-Headers: X-PINGOTHER, Content-Type, Accept-Encoding, cache-control");
|
||||
header("Access-Control-Max-Age: 86400");
|
||||
header('content-type: application/json');
|
||||
echo json_encode($availableFields);
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user