CORS requests are divided into simple requests and non-simple requests. For non-simple requests, the CORS definition needs to initiate a pre-check for these non-simple requests, that is, initiate an option request, and wait until it is confirmed that the server allows cross-domain Resend the original non-simple request, so I want to ask why preflight is needed?
Here is an answer on the stack. I don’t understand it very well. Is there anyone willing to translate it or briefly summarize it?
http://stackoverflow.com/ques...
If you want to go to someone’s house to get something, you must get the owner’s permission
Cross-domain is caused by the same-origin policy of the browser.
Pre-request is the behavior of the browser. It takes the current domain name and asks the server if it can pass.
The two most commonly used ones
get does not have cross-domain by default, which means that if you allow get, you will have the expectation that it will be taken away by others. jsonp takes advantage of this;
post has cross-domain because it will affect resources according to the meaning. Must be inspected first.