vincent
vincent

Reputation: 2181

Should an OPTIONS request ever return 429?

Should an OPTIONS request ever return a 429?

The problem is really that a Browser client (js) can not detect the 429 correctly when returned from an OPTIONS request. So I'm leaning towards only returning 429 for non OPTIONS requests.

What is best practise here?

Upvotes: 3

Views: 426

Answers (1)

DS.
DS.

Reputation: 24110

OPTIONS is a Preflight request. Typically the response is static with just a few headers. So sending the real response is no more strain on the server than responding with 429 (Too Many Requests). If browsers have trouble with it, it would make sense to always send the real response for OPTIONS, and let the immediately-following actual request get the error.

Upvotes: 1

Related Questions