naystack - v1.9.9
    Preparing search index...

    Function withCors

    • 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).

      Returns T

      The wrapped handler with CORS support.