If the backend interface is set to restrict domain name access, can I request data by pretending to be the other party's domain name or IP through node or ajax?
ringa_lee2017-06-14 10:55:50
You can configure a reverse proxy through niginx to solve cross-domain problems
曾经蜡笔没有小新2017-06-14 10:55:50
In this case, ajax’s jsonp will not work. You can forward it through node middleware
middleware: [ // 请求代理,按需设置
proxy('/api', {
target: 'http://op.juhe.cn', // 目标地址
changeOrigin: true,
ws: true, //websocket
pathRewrite: {
'^/api': '' //重写地址
}
})
]