特定のオリジンからのリクエストを許可する

This commit is contained in:
斎藤 快斗 2023-05-17 10:40:43 +09:00
parent 4cf444ab42
commit 1ceab68b42

View File

@ -14,8 +14,12 @@ helmetDirectives['navigate-to'] = ["'self'"];
helmetDirectives['style-src'] = ["'self'", 'https:'];
helmetDirectives['report-uri'] = ["'self'"];
async function bootstrap() {
const app = await NestFactory.create(AppModule, {
cors: process.env.CORS === 'TRUE',
const app = await NestFactory.create(AppModule);
//XXX 特定のオリジンからのリクエストは許可する
app.enableCors({
origin: 'http://localhost:8180',
methods: 'GET,PUT,POST,DELETE',
allowedHeaders: 'Content-Type',
});
app.use(
helmet({