跨域问题,Request header field XXXXX is not allowed by Access-Control-Allow-Headers 的问题
Posted 过冬麦子
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了跨域问题,Request header field XXXXX is not allowed by Access-Control-Allow-Headers 的问题相关的知识,希望对你有一定的参考价值。
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Methods" value="GET,POST,PUT,DELETE,OPTIONS" />
<add name="Access-Control-Allow-Headers" value="Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With,SOAPAction" />
</customHeaders>
</httpProtocol>
浏览器为了安全起见,会先发送一个 options 请求,确保请求发送是安全的,一般 POST DELETE PUT 等请求都会修改服务器资源,所以浏览器会先发一个请求,问问服务器是否会正确(允许)请求,若不支持 options 请求,请求也会死掉
以上是关于跨域问题,Request header field XXXXX is not allowed by Access-Control-Allow-Headers 的问题的主要内容,如果未能解决你的问题,请参考以下文章
Request header field Content-Type is not allowed by Access-Control-Allow-Headers
axios跨域请求报错:Request header field content-type is not allowed by Access-Control-Allow-Headers in pref
Status Code: 431 Request Header Fields Too Large
加载资源失败:服务器响应状态为 431 (Request Header Fields Too Large)
angularjs post Request header field Content-Type is not allowed by Access-Control-Allow-Headers in p