Preflight OPTIONS error despite correct CORS configuration

Hello everyone,

I’m currently facing an issue when deploying a NestJS API on Vercel:
Preflight OPTIONS requests consistently fail (401/403/405) even though:

  • CORS is properly configured in main.ts (origin, methods, allowedHeaders, credentials).

  • The OPTIONS routes correctly return a 204 with all required Access-Control-Allow-* headers.

  • The routes have been allowed in vercel.json (for example /auth/*).

  • I have temporarily disabled all security measures (auth middlewares, validations) to test, but the issue persists.

Context:

  • Deployment on Vercel (api/index.ts properly set up to handle preflight)

  • Cross-testing local ↔ staging: works fine locally, fails on Vercel

  • This strongly appears to be an internal Vercel issue (support ticket already opened)

My question:
Has anyone encountered this issue before?
Do you know of a solution or workaround to make OPTIONS requests pass correctly on Vercel in this scenario?

Thanks in advance for your feedback!