itty-cors
itty-cors copied to clipboard
Dead-simple CORS handling for any itty-router API (test with Cloudflare Workers, but works anywhere)!
Deprecation Notice
itty-cors
has been fully deprecated in favor of itty-router/cors
.
This complete rewrite brings the following:
- full support for industry-standard options (matches express.js)
- far more control of matching/reflecting origins
- true wildcard support
- fixes a nasty race condition that could appear under heavy multi-user load
- 20% smaller (we somehow shed over 100 bytes)
- 100% test coverage, like anything in itty-router core
itty-router v5.x CORS Guide
https://itty.dev/itty-router/cors
v5.x Migration Guide
https://itty.dev/itty-router/migrations/v4-v5