Search code examples
corspreflighthttp-status

What is the correct success status code for Preflights(option) request?


We're developing new frontend (angular) for our older backend (java). After enabling cors all requests(POST) are working as expected.

But preflights(option) request response with 'status code 202 OK'.

So before digging in and change 'the working code', I'm asking here, What is the standard success code for 'Preflights (option)' request?


Solution

  • As per the spec https://fetch.spec.whatwg.org/#cors-preflight-fetch,

    Anything from 200 to 299 is ok.

    You should just send back the status for the CORS preflight OPTIONS request that you normally send back for any other OPTIONS request. The relevant specs does not require anything more than that.