intermediateCORS: Cross-Origin Resource Sharing
What triggers a CORS preflight (OPTIONS) request, and what happens if it fails?
A preflight is triggered for 'non-simple' requests — those using methods other than GET/HEAD/POST-with-simple-content-type, or including custom headers like Authorization. If the server doesn't respond to the OPTIONS request with the correct Access-Control-Allow-* headers, the browser blocks the actual request entirely and it never reaches your controller — even though tools that don't enforce CORS (like Postman) would succeed.
Ready to master this question?
Generate a complete walkthrough — background, the full answer in plain language, a working code example explained line by line, a real-world scenario, common mistakes, and how this same question gets asked in different ways.
Sign in to generate a response