Wraps a Next.js route handler to add CORS headers for the specified allowed origins.
Same-origin requests are passed through unchanged. Cross-origin requests from
unlisted origins are rejected with HTTP 403.
Parameters
handler: T
The route handler to wrap.
OptionalallowedOrigins: string[]
List of permitted origins. If empty or undefined, the handler is returned as-is (no CORS).
Wraps a Next.js route handler to add CORS headers for the specified allowed origins. Same-origin requests are passed through unchanged. Cross-origin requests from unlisted origins are rejected with HTTP 403.