How to make AngularJS ignore ajax OPTIONS method?

When executing a cross-domain AJAX POST request, AngularJS first sends an HTTP OPTIONS request. jQuery does the same, and I understand that this is part of the specification. The difference is that if an error occurs with the OPTIONS request (for example, the server does not support it, as is often the case), jQuery will continue and will still make a POST request, where AngularJS just fails and refuses. Is there a way to get it to make a POST request independently?

+4
source share
1 answer

Since Guillaume86 said that the OPTIONS request (aka CORS pre-sale request) is sent by the browser if the request is made by a cross-domain. See specifications here http://www.w3.org/TR/cors/ . The browser will cache it if you set the cache header. For instance:

Access-Control-Max-Age: 1728000 
+3
source

Source: https://habr.com/ru/post/1436774/


All Articles