How to skip the OPTIONS preflight request?

The preflight is being triggered by your Content-Type of application/json. The simplest way to prevent this is to set the Content-Type to be text/plain in your case. application/x-www-form-urlencoded & multipart/form-data Content-Types are also acceptable, but you’ll of course need to format your request payload appropriately. If you are still seeing a preflight after making this … Read more

AngularJS performs an OPTIONS HTTP request for a cross-origin resource

OPTIONS request are by no means an AngularJS bug, this is how Cross-Origin Resource Sharing standard mandates browsers to behave. Please refer to this document: https://developer.mozilla.org/en-US/docs/HTTP_access_control, where in the “Overview” section it says: The Cross-Origin Resource Sharing standard works by adding new HTTP headers that allow servers to describe the set of origins that are … Read more

Why is an OPTIONS request sent and can I disable it?

edit 2018-09-13: added some precisions about this pre-flight request and how to avoid it at the end of this reponse. OPTIONS requests are what we call pre-flight requests in Cross-origin resource sharing (CORS). They are necessary when you’re making requests across different origins in specific situations. This pre-flight request is made by some browsers as … Read more

No ‘Access-Control-Allow-Origin’ header is present on the requested resource—when trying to get data from a REST API

This answer covers a lot of ground, so it’s divided into three parts: How to use a CORS proxy to get around “No Access-Control-Allow-Origin header” problems How to avoid the CORS preflight How to fix “Access-Control-Allow-Origin header must not be the wildcard” problems How to use a CORS proxy to avoid “No Access-Control-Allow-Origin header” problems … Read more