CORS (Cross-Origin Resource Sharing)
viaLeetCode
Question: What is CORS? Explain its use cases.
Expected discussion: CORS is a browser security mechanism that restricts web pages from making requests to a different origin (scheme/host/port) than the one that served the page, unless the target server explicitly allows it via response headers (Access-Control-Allow-Origin, etc.). For non-simple requests, the browser first sends a preflight OPTIONS request. Use cases: allowing a frontend on one domain to call an API on another, while preventing malicious cross-origin reads of sensitive data by default.
asked …