Try 30 days of free premium.

API CORS pre-flight request, method not allowed

viiter wrote 7 years ago: 1

Hello

I'm building a website that uses tvmaze api, i am also using AXIOS as my http/ajax client, now i am not sure if its my browser or axios itself,

when i do a GET query to your API endpoint a pre-flight request with the method OPTIONS is sent first to check if GET method is allowed, but the API endpoint says that OPTIONS is not a valid method, only GET and HEAD are allowed

Would it be possible to allow method OPTIONS?

info about the issue with axios
https://github.com/mzabriskie/axios/issues/475

info about the OPTIONS method
https://developer.mozilla.org/en-US/docs/Web/HTTP/Methods/OPTIONS


david wrote 7 years ago: 1

In our public API there are only unauthenticated GET requests, so a CORS preflight request isn't necessary. Your code is probably doing something unnecessary like using a different HTTP method or trying to authenticate the request, which causes your browser to send the preflight request.

(See "Simple requests" in your mozilla.org link)

Try 30 days of free premium.