diff --git a/src/pages/api/websites/[websiteId]/stats.ts b/src/pages/api/websites/[websiteId]/stats.ts index dfc9198df..ff999086e 100644 --- a/src/pages/api/websites/[websiteId]/stats.ts +++ b/src/pages/api/websites/[websiteId]/stats.ts @@ -60,6 +60,11 @@ export default async ( const { websiteId, compare } = req.query; + // 处理 OPTIONS 请求 + if (req.method === 'OPTIONS') { + return res.status(200).end(); // 返回 200 OK 表示允许跨域 + } + if (req.method === 'GET') { if (!(await canViewWebsite(req.auth, websiteId))) { return unauthorized(res);