[MantisBT] CORS 跨域问题

· PHP

需要到 MantisBT 根目录下找到 api/rest/index.php 文件,在其顶部添加

header("Access-Control-Allow-Origin: *"); // 按实际情况放行
header("Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS");
header("Access-Control-Allow-Headers: Authorization, Content-Type, Accept-Language");

if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
    http_response_code(200);
    exit();
}

发表评论