在NestJS中允许接口跨域

//main.ts
app.enableCors({
    origin: '*',
    methods: 'GET,HEAD,PUT,PATCH,POST,DELETE',
    preflightContinue: true,
    optionsSuccessStatus: 204,
    credentials: true,
    allowedHeaders: [
      'Origin',
      'X-Requested-With',
      'Content-Type',
      'Accept',
      'Content-Type',
      'Authorization',
    ],
  });


在NestJS中允许接口跨域
https://blog.jiang.in/archives/86d2679f-3d3f-4439-ba63-a6c5fff0deb1
作者
Jiang
发布于
2024年09月23日
更新于
2024年10月15日
许可协议