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. Lock wait timeout exceeded数据库死锁问题

    环境 MySQL5.5 现象 A.数据更新或新增后数据经常自动回滚. B.表操作总报 Lock wait timeout exceeded 并长时间无反应 解决方法 A.应急方法:show proce ...

  2. (寒假GYM开黑)2018 German Collegiate Programming Contest (GCPC 18)

    layout: post title: 2018 German Collegiate Programming Contest (GCPC 18) author: "luowentaoaa&q ...

  3. 线段树维护矩阵【CF718C】 Sasha and Array

    Description 有一个长为\(n\)的数列\(a_{1},a_{2}...a_{n}\),你需要对这个数列维护如下两种操作: \(1\space l \space r\space x\) 表示 ...

  4. 微信小程序开发教程(三)项目目录及文件构成

    第二章我们已经创建了一个Hello WXapplet示例小程序.我们从文件目录结构来了解Hello WXapplet项目的构成. 目录结构显示,在小程序项目的根目录下面包含3个app开头的文件(app ...

  5. [BZOJ 1799] self 同类分布

    Link: BZOJ 1799 传送门 Solution: 一句话的题目,看得爽,做得烦 一般这类和数位相关的都是数位$dp$吧 不过一开始还是感觉不太可做,毕竟每个数模数不同 但要发现,模数最高也只 ...

  6. 使用jmatio读写matlab数据文件

    /** * Created by hfz on 2016/2/23. */ import com.jmatio.io.*; import com.jmatio.types.MLDouble; impo ...

  7. Chrome DevTools 代码覆盖率功能详解

    共 1812 字,读完需 3 分钟.工欲善其事必先利其器,前端周刊本周起每周会加餐 1 篇工具技巧,里面辅以动图,让大家看完就能学会,并上手使用.本文会介绍 Chrome Canary 新增的代码覆盖 ...

  8. Webpack安装和配置

    一.安装和配置webpack 1.全局安装webpack 这样就安装好了webpack,可以再全局通过webpack -v来查看是否安装成功. 2.先创建项目目录结构,根目录是mywebpack.进入 ...

  9. Python 操作mongodb 简单实例

    1.建立数据库用户 要读写 mongo数据库,默认没有用户名和密码也可以对数据库进行读写操作,但是从安全的角度,最好给要操作的数据库建立用户名和密码. 打开mongo数据库服务,打开mongo.exe ...

  10. HDU 5360 Hiking(优先队列)2015 Multi-University Training Contest 6

    Hiking Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total S ...