AJAX in Chrome sending OPTIONS instead of GET/POST/PUT/DELETE?

Chrome is preflighting the request to look for CORS headers. If the request is acceptable, it will then send the real request. If you’re doing this cross-domain, you will simply have to deal with it or else find a way to make the request non-cross-domain. This is why the jQuery bug was closed as won’t-fix. This is by design.

Unlike simple requests (discussed above), “preflighted” requests first
send an HTTP request by the OPTIONS method to the resource on the
other domain, in order to determine whether the actual request is safe
to send. Cross-site requests are preflighted like this since they may
have implications to user data. In particular, a request is
preflighted if:

  • 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)

Leave a Comment