Skip to main content
Module

x/workers_middleware/cors.ts>strictCORS

Placeholder for Worker-based middleware solution
Latest
variable strictCORS
import { strictCORS } from "https://deno.land/x/workers_middleware@v0.1.0-pre.36/cors.ts";

A CORS middleware that only grants the permissions defined via options.

Note that applying this middleware to your routes isn't enough for non-GET requests. Pre-flight/OPTIONS routes need to be added manually:

router.options('/your/path', strictCORS({ ... }), () => noContent())
router.post('/your/path', strictCORS({ ... }), (req, {}) => ok())

type

(options: StrictCORSOptions) => unknown