#Cors problem when deployed project

2 messages · Page 1 of 1 (latest)

neat idol
#

so i have deployed my project.

Acess to XMLHttpRequest at 'https://api.checkapi.app/api/authorization/refresh' from origin 'https://checkapi.app' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

in local machine it works fine.

async function bootstrap() {
  const app = await NestFactory.create(AppModule, {
    cors: {
      origin: process.env.CLIENT_URL,
      credentials: true,
    },
  });
  app.use(cookieParser());
  app.use(mongoSanitize());
  app.use(helmet());
  const server = await app.listen(5000, () => {
    console.log('server is working');
  });
}

What i have tried: origin true or cors: true in create function. same in app.enableCorse.
tried app.ena.... without anything, or with options like allows header and preflight. Any ideas. I will be glad for any help

neat idol
#

Answer: i have spend 3 hours of my life to learn a lesson about every cloud have a policy. In my cause my cloud wants 0.0.0.0 host.