-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
每日1问-chrome面板里面同一个链接发了两次请求。请求方式分别是OPTIONS和GET #31
Comments
贴出请求代码
表面差异先从表象看看区别[上面两个请求分别以
OPTIONS的作用
注意到OPTIONS请求的Request Header中有 而Access-Control-Allow-Headers的作用是通知服务器在真正的请求中会采用哪些请求首部。
Preflight request(预检请求)
所以即使我们没有写这样的代码,这条OPTIONS请求还是发送出去了
难道每次ajax请求都会发送两个请求吗?(PS:Preflight request产生的条件)
我们这里是设置了header,所以发了一条Preflight request AJAX与CORSInitiator中标记了OPTIONS请求的js堆栈,zepto.js最后直接与
总结跨域请求中设置了自定义的header字段 更多 |
The text was updated successfully, but these errors were encountered: