header field token is not allowed by Access-Control-Allow-Headers in preflight response问题解决

Posted 蓝色风暴003

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了header field token is not allowed by Access-Control-Allow-Headers in preflight response问题解决相关的知识,希望对你有一定的参考价值。

今天下午,本来打算使用aioxs在header里传一个token给后台服务器,如下图所示:

结果,控制台报了如下的错:

 然后,我不停地百度,不停的改后台express的header设置,一直没有效果;

最后,我才发现,我只要在原来的header设置里加多一个‘token’就可以了;

具体思路我是参考了这个链接:https://segmentfault.com/q/1010000015572348?sort=created

以上是关于header field token is not allowed by Access-Control-Allow-Headers in preflight response问题解决的主要内容,如果未能解决你的问题,请参考以下文章

跨域问题,Request header field XXXXX is not allowed by Access-Control-Allow-Headers 的问题

angularjs post Request header field Content-Type is not allowed by Access-Control-Allow-Headers in p

解决Request header field Content-Type is not allowed by Access-Control-Allow-Headers in preflight 跨域问题

axios.post请求出错:Request header field content-type is not allowed by Access-Control-Allow-Headers in……

axios跨域请求报错:Request header field content-type is not allowed by Access-Control-Allow-Headers in pref

AFHTTPClient 设置 Authorization Header Field 像“Token token='\75845hjhrtje845395748'” 但我只想成为里面的令牌