@Hanry654

Как открыть cors для всех api на nest js?

main.ts
import { NestFactory } from '@nestjs/core';
import { AppModule } from './app.module';
import cors from 'cors'

async function bootstrap() {
  const app = await NestFactory.create(AppModule);
  app.use(cors({
    credentials: true,
    origin: '*'
  }))
  await app.listen(3003);
}

bootstrap().then();


has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
  • Вопрос задан
  • 2341 просмотр
Решения вопроса 1
Fragster
@Fragster
помогло? отметь решением!
origin: true
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы