axios 加入header之后,请求出现

Failed to load http://localhost:8080/team.php: Request header field x-jwt-header is not allowed by Access-Control-Allow-Headers in preflight response.

//POST传参序列化(添加请求拦截器)
axios.interceptors.request.use(config => {
config.headers['x-jwt-header'] = localStorage.token
return config;
},error =>{
alert("错误的传参", 'fail')
return Promise.reject(error)
})

原因是后端没有开启对header的允许。php中输入以下代码即可:

header('Access-Control-Allow-Headers:x-jwt-header,content-type'); 

Failed to load http://localhost:8080/team.php: Request header field x-jwt-header is not allowed by Access-Control-Allow-Headers in preflight response.的更多相关文章

  1. Linux项目部署 jdk tomcat 安装配置 linux下 failed connect to localhost:8080;Connection refused

         ONBOOT=yes 5.安装wget (1)安装 yum -y install wget (2) 查看版本  wget --version或 wget -V 一.安装jdk 配置 (1)安 ...

  2. Spring Boot Failed to load resource: the server responded with a status of 404 ()

    出现错误: Failed to load resource: the server responded with a status of 404 () 但是其他页面正常显示: 原因: 浏览器看一下:  ...

  3. Failed to load c++ bson extension, using pure JS version

    Failed to load c++ bson extension, using pure JS version npm install mongodbnpm install bson npm ins ...

  4. CentOS7关闭/开启防火墙出现 Unit iptables.service failed to load

    在vm中安装好tomcat,而且在liunx中使用nc命令可以返回成功,但是更换到window中访问不到tomcat的情况,是由于linux防火墙的问题造成的,传统的解决方式有2中 第一种解决方案: ...

  5. The connection to the server localhost:8080 was refused - did you specify the right host or port?

    The connection to the server localhost:8080 was refused - did you specify the right host or port? 解决 ...

  6. Failed to load ApplicationContext ,Error creating bean with name 'adminUserService': Injection of autowired dependencies failed;

    Druid配置的时候出现这个问题: "C:\Program Files\Java\jdk1.8.0_191\bin\java" -ea -Didea.test.cyclic.buf ...

  7. 解决CentOS7关闭/开启防火墙出现Unit iptables.service failed to load: No such file or directory.

    CentOS7中执行 service iptables start/stop 会报错Failed to start iptables.service: Unit iptables.service fa ...

  8. 2018.12.31 Failed to load JavaHL Library.错误解决

    创建项目出现下面的错误 Failed to load JavaHL Library. These are the errors that were encountered: no libsvnjava ...

  9. Spring-boot2.0.1.BUILD-SNAPSHOT整合Elasticsearch报failed to load elasticsearch nodes错误解决办法

    spring-boot整合es的application.properties的默认配置为: spring.data.elasticsearch.cluster-nodes=localhost:9200 ...

随机推荐

  1. LCA【SP913】Qtree - Query on a tree II

    Description 给定一棵n个点的树,边具有边权.要求作以下操作: DIST a b 询问点a至点b路径上的边权之和 KTH a b k 询问点a至点b有向路径上的第k个点的编号 有多组测试数据 ...

  2. 1353表达式括号匹配(stack)

    [题目描述] 假设一个表达式有英文字母(小写).运算符(+,—,*,/)和左右小(圆)括号构成,以“@”作为表达式的结束符.请编写一个程序检查表达式中的左右圆括号是否匹配,若匹配,则返回“YES”:否 ...

  3. 谜题27:变幻莫测的i值

    与谜题26中的程序一样,下面的程序也包含了一个记录在终止前有多少次迭代的循环.与那个程序不同的是,这个程序使用的是左移操作符(<<).你的任务照旧是要指出这个程序将打印什么.当你阅读这个程 ...

  4. DNS隧道工具dns2tcp

    DNS隧道工具dns2tcp   在很多网络环境中,防火墙会限制出站流量,主机往往只能访问外网主机有限的几个端口,如DNS的53端口.这时,就可以通过DNS请求和响应机制,建立通信隧道.Kali Li ...

  5. Codeforces 702 D Road to Post Office

    题目描述 Vasiliy has a car and he wants to get from home to the post office. The distance which he needs ...

  6. 【dfs序】【set】bzoj3991 [Sdoi2015]寻宝游戏

    在考试代码的基础上稍微改改就a了……当时为什么不稍微多想想…… 插入/删除一个新节点时就把其dfn插入set/从set中删除. 当前的答案就是dfn上相邻的两两节点的距离和,再加上首尾节点的距离. 比 ...

  7. 【分块】bzoj2453 维护队列

    http://www.cnblogs.com/autsky-jadek/p/4020296.html 同bzoj2120. #include<cstdio> #include<cma ...

  8. 国内流行的开源.net微信公众平台SDK对比分析

    一.引言 目前微信公众平台正如火如荼的进行中,微信虽然在海外市场不敌WhatsApp,但是已经俘获了国内绝大部分用户的心.作为国内最大的,超级"app",微信已算是成功问鼎了.公众 ...

  9. C#中Math的使用总结

    1.向上进位取整.Math.Ceiling 例如: Math.Ceiling(32.6)=33; Math.Ceiling(32.0)=32; 2.向下舍位取整.Math.Floor 例如: Math ...

  10. 开源用户界面和布局的套件XiaoCai.WinformUI(美化用户界面利器)

    发布一款开源用户界面和布局的套件,请朋友们多提提宝贵建议! XiaoCai.WinformUI主要是解决用户界面和布局的套件,能够快速进行合理性布局,美化用户界面. 因为之前发布到谷歌里,好多朋友都说 ...