It is not AngularJS directly that does the OPTION request, it's done by XHR. You can check the AngularJS source, AngularJS does not explicitly perform an OPTION request.
According to MDN, XHR first does an OPTION request when:
- It uses methods other than GET, HEAD or POST. Also, if POST is used to send request data with a Content-Type other than application/x-www-form-urlencoded, multipart/form-data, or text/plain, e.g. if the POST request sends an XML payload to the server using application/xml or text/xml, then the request is preflighted.
- It sets custom headers in the request (e.g. the request uses a header such as X-PINGOTHER)
I noticed that AngularJS sets the content type header for POST requests to application/json;charset=utf-8
. I would try to set it back to text/plain
.
$httpProvider.defaults.headers.post = {'Content-Type': 'text/plain'}
If this doesn't work, I suggest you check what the differences are between the request headers when a request is made by $.ajax
and one made by $http