跨域请求中的option请求

2019-08-04  本文已影响0人  strong9527

最近在工作中,遇到了跨域请求的问题,其中有的请求用到了option欲请求,所以今天总结一下。

跨域请求出现options请求的原因:

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

翻译过来就是:复杂跨域请求,首先会发送一个options请求来决定真正的请求是否足够安全。

那么如果区分简单请求以及复杂请求就比较关键了,下面是几个关键的点:

method

headers

其中 content-type 值只包括

上一篇 下一篇

猜你喜欢

热点阅读