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

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

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

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

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

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

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

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

05-23 11:48