CORS - What is the motivation behind introducing preflight requests?

前端 未结 9 2400
轻奢々
轻奢々 2020-11-22 11:30

Cross-origin resource sharing is a mechanism that allows a web page to make XMLHttpRequests to another domain (from wikipedia).

I\'ve been fiddling with COR

9条回答
  •  旧时难觅i
    2020-11-22 12:25

    CORS allows you to specify more headers and method types than was previously possible with cross-origin or

    .

    Some servers could have been (poorly) protected with the assumption that a browser cannot make, e.g. cross-origin DELETE request or cross-origin request with X-Requested-With header, so such requests are "trusted".

    To make sure that server really-really supports CORS and not just happens to respond to random requests, the preflight is executed.

提交回复
热议问题