标签:iframe === work efault res local 代码 put lob
1 app.all(‘*‘, (req, res, next)=>{ 2 res.header("Access-Control-Allow-Origin", "*"); 3 res.header("Access-Control-Allow-Headers", "Content-Type,Content-Length, Authorization, Accept,X-Requested-With"); 4 res.header("Access-Control-Allow-Methods","PUT,POST,GET,DELETE,OPTIONS"); 5 res.header("X-Powered-By",‘ 3.2.1‘) 6 7 if(req.method=="OPTIONS") res.send(200);/*让options请求快速返回*/ 8 else next(); 9 });
1 port: 8080, 2 proxyTable: { 3 ‘/api‘: { 4 target: ‘http://www.ainyi.com‘, // 目标接口域名 5 changeOrigin: true, // 是否跨域 6 // secure: false, // 如果是https接口,需要配置这个参数 7 pathRewrite: { 8 ‘^/api‘: ‘‘ // 重写接口,一般不更改 9 } 10 }, 11 },
http://localhost:8080/api ===> http://www.ainyi.com/api
跨域 webpack + vue-cil 中 proxyTable 处理跨域
标签:iframe === work efault res local 代码 put lob
原文地址:https://www.cnblogs.com/ainyi/p/9335952.html