forked from Wavyzz/dolibarr
Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
This commit is contained in:
@@ -55,6 +55,15 @@ if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
|
|||||||
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Response for preflight requests (used by browser when into a CORS context)
|
||||||
|
if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
|
||||||
|
header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
|
||||||
|
http_response_code(204);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
|
||||||
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
|||||||
Reference in New Issue
Block a user