前端跨域解决方法整理
前言
跨域行为描述: 跨域发生的位置不是服务端,而是浏览器的一种行为
解决方式
1、方式一
res.setHeader('Access-Control-Allow-Origin','http://localhost:3000')
2、方式二(关于预检请求)
if (method == "OPTIONS" && url == "/api/users") {
res.setHeader('Access-Control-Allow-Credentials'.
原创
2020-08-05 09:26:40 ·
215 阅读 ·
0 评论