How do you send a custom header in a cross-domain (CORS) XMLHttpRequest?
问题 I am trying to send a CORS request for a JSON payload. I control both the server and the client. I'm following along here: https://developer.mozilla.org/en-US/docs/HTTP/Access_control_CORS?redirectlocale=en-US&redirectslug=HTTP_access_control The server has a custom header that must be sent along with every request. This custom header therefore makes the request 'not simple' and thus the request must be preflighted with an OPTIONS request. I can see jquery making the OPTIONS request, but it