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

原文地址:https://www.cnblogs.com/thing/p/9343029.html

时间: 2024-10-08 00:24:03

header field token is not allowed by Access-Control-Allow-Headers in preflight response问题解决的相关文章

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

在做项目时,用到axios,数据用post提交时,老是报错,错误提示为: 1 Access to XMLHttpRequest at 'http://127.0.0.1:3000/api/add' from origin 'http://localhost:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers i

跨域问题,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" />        &

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

现象: 1. angular http 不配置data(请求参数)时不报错 2. 加上请求参数后,报错 3. 服务端response.headers().set(HttpHeaders.Names.ACCESS_CONTROL_ALLOW_HEADERS, HttpHeaders.Names.CONTENT_TYPE);后ok 经查: 1. angularjs默认 application/json 2. 无参数不发PreOption请求 3. urlencode不发PreOption请求 原文地

You (root) are not allowed to access to (crontab) because of pam configuration

巡检发现一台Linux服务器上的作业没有如期发送邮件,登录服务器检查后发现作业并没有执行,于是检查一下crontab的设置.结果发现如下错误: [[email protected] ~]# crontab -l Authentication token is no longer valid; new one required You (root) are not allowed to access to (crontab) because of pam configuration. [[emai

java打包遇到问题java.io.IOException: invalid header field

问题:java打包时报以下错误 $ jar -cvmf main.txt test.jar Shufile1.class java.io.IOException: invalid header field at java.util.jar.Attributes.read(Attributes.java:410) at java.util.jar.Manifest.read(Manifest.java:199) at java.util.jar.Manifest.<init>(Manifest.

严重: Error in dependencyCheck java.io.IOException: invalid header field(tomcat启动成功可是訪问web项目404错误)

tomcat启动的时候出现 严重: Error in dependencyCheck java.io.IOException: invalid header field 而且tomcat也不自己主动reload 然后訪问在eclipse里面訪问web页面出现404,原来web程序一直没有被load进tomcat里面 原因:WebContent > META-INF > MANIFEST.MF文件不是多了几个空行就是多了几个空格,导致出现IO错误 解决的方法去掉空格和空行 重新启动tomcat

java.io.IOException: invalid header field

通过本文, 我们明白了什么是 jar的清单文件 MANIFEST.MF, 简单示例: E:\ws\Test\WEB-INF\classes>jar cvfm testCL.jar ListTest.class java.io.IOException: invalid header field at java.util.jar.Attributes.read(Attributes.java:406) at java.util.jar.Manifest.read(Manifest.java:199)

解决Bug:Size of a request header field exceeds server limit

用了cms 发现这玩意真不好,老是有各种奇芭的问题跳出来 有时浏览网页时会出现 Bad Request Your browser sent a request that this server could not understand. Size of a request header field exceeds server limit. 意思为:错误的请求.您的浏览器发送一个请求,该服务器无法理解.一个请求头域的大小超过服务器的限制. 以下是解决方法,不过,我个人感觉,不可能无限制的增大请求

Access control differentiation in trusted computer system

A trusted computer system that offers Linux? compatibility and supports contemporary hardware speeds. It is designed to require no porting of common applications which run on Linux, to be easy to develop for, and to allow the use of a wide variety of