Day 18
Today I debugged an issue with accessing backend endpoints from a Next.js frontend talking to a NestJS API.
The browser was blocking requests due to a CORS error — the Authorization header was not allowed in the preflight response. Even though frontend domains were correctly set, I forgot to include Authorization in allowedHeaders.
After updating enableCors() to:
`allowedHeaders: 'Authorization, Content-Type, Accept'`
…the issue disappeared, and the dashboard successfully fetched the user's subscriptions from the backend.
https://write.tyolabs.com/2025/07/18/tin-day18-the-cors-error-with-authorization-header/
#programming #nestjs #nextjs #daybyday #fullstack #javascript