mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-23 05:12:39 +00:00
fix: plugin cost (#3533)
This commit is contained in:
@@ -3,10 +3,13 @@ import NextCors from 'nextjs-cors';
|
||||
|
||||
export async function withNextCors(req: NextApiRequest, res: NextApiResponse) {
|
||||
const methods = ['GET', 'eHEAD', 'PUT', 'PATCH', 'POST', 'DELETE'];
|
||||
|
||||
const allowedOrigins = process.env.ALLOWED_ORIGINS?.split(',');
|
||||
const origin = req.headers.origin;
|
||||
|
||||
await NextCors(req, res, {
|
||||
methods,
|
||||
origin: origin,
|
||||
origin: allowedOrigins || origin,
|
||||
optionsSuccessStatus: 200
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user