CORS and Panic Recovery Middleware
Cross-origin policies and recovering from panics
What is CORS?
Cross-Origin Resource Sharing (CORS) is a browser security mechanism that restricts which origins can make HTTP requests to your API. The server opts in by setting response headers.
CORS preflight
Before a cross-origin request with a custom header or non-simple method, the browser sends an OPTIONS preflight. Your middleware must handle OPTIONS and return 200 with CORS headers.
All lessons in this course
- HTTP Middleware Chain Fundamentals
- Logging and Request ID Middleware
- Auth and Rate Limiting Middleware
- CORS and Panic Recovery Middleware