CORS actually specifies that two requests should be made to the server on an AJAX call (if certain conditions apply, like sending custom headers).
The first request (the one with the OPTIONS
method) is called pre-flight and is used to check if it's safe to send the full request to the server. The response from the server should contain a valid Access-Control-Allow-Origin
header containing the URL of the client or *
.
Your server (and not the client) is the one that needs to support CORS. It seems you are using .Net for it, so you may want to take a look here on how configure IIS.
You can read more about CORS here.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…