Web security · Concept
CORS and the same-origin policy
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voiceThe interviewer asks
What is CORS? Why does my fetch to api.example.com work in Postman but fail in the browser? What is a preflight?
Then
Follow-ups the interviewer asks next
- Simple vs preflighted requests (methods, headers, content types).
Access-Control-Allow-Credentialscan't be combined with*.- Caching preflights (
Access-Control-Max-Age). - Dev proxy vs fixing the server.
The answer
What a strong answer covers
- The same-origin policy is a browser rule; CORS is a server opt-in through response headers
- Origin = scheme + host + port
- CORS is not authentication and does not protect the server
The red pen
Common traps
Avoid:"CORS is a server security feature that blocks requests" (the request often reaches the server).
Practise this out loud
Say your answer out loud to an AI interviewer that follows up, and get a score for it.
Practise by voicePractise questions like this out loud
Sign up and start with a 15-minute interview with the full report, and an English conversation. No card needed.