标签:IV div span require re模块 跨域请求 https UNC ecshop
yarn add http-proxy-middleware
app.js
var proxy = require("http-proxy-middleware");
app.js
var app = express();
// 请求的路由地址(接口文件) 进行跨域请求的协议域名
app.use(‘/ajax_www_68ecshop_com.php‘, proxy({target: ‘https://www.jkslw.cn‘, changeOrigin: true}))
index.html
$.ajax({ type:"get",
//直接传入路由地址,无需加上域名 url:"/ajax_www_68ecshop_com.php?act=tipword&word=xiaomi&152790640006565", dataType:"json", success:function(data){ console.log(data); }
})
解决跨域之服务器代理http-proxy-middleware模块
标签:IV div span require re模块 跨域请求 https UNC ecshop
原文地址:https://www.cnblogs.com/yingyingying/p/9125005.html