js请求头跨域问题

No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 400.

response.setHeader("Access-Control-Allow-Origin", "*");
response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE");
response.setHeader("Access-Control-Max-Age", "3600");
response.setHeader("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");

所有设置为*号也是不行

阅读 3.8k
4 个回答

你得让后台设置成*啊

后端改起来很容易

从目前的信息只能猜测是你的request header origin 没有设置。 请你检查一下, 如果设置了,请你贴图然后更新下问题

推荐问题
宣传栏