查看proxy代理后的真实地址(详解) |
您所在的位置:网站首页 › wins代理怎么查看 › 查看proxy代理后的真实地址(详解) |
方法一:终端查看
"/iptv-monitor/check": {
target: 'http://xxx.xxx.xx.xx:xx',
changeOrigin: true,
//终端查看
logLevel: 'debug',
pathRewrite: {
'^/iptv-monitor/check': '/iptv-check'
}
},
接口 // 新首页接口 export function map() { return request({ url: '/check/selectErrorData', method: 'get', }) }总结:就是target和代理后路径的拼接 "/iptv-monitor/check": { target: 'http://xxx.xxx.xx.xx:xx', changeOrigin: true, //浏览器控制台查看 onProxyRes(proxyRes, req, res) { //这里的req.url是经过路径重写后的url const realUrl = new URL(req.url || '', 'http://xxx.xx.xx.xx:xx)?.href || ''; proxyRes.headers['x-real-url1'] = realUrl; }, pathRewrite: { '^/iptv-monitor/check': '/iptv-check' } }dev-server的proxy有两个事件“onProxyReq”,“onProxyRes”,可以在请求发送前和响应后对请求内容进行更改。 onProxyReq的第一个参数proxyReq是node http.ClientRequest的实例,后两个参数req和res分别是Express框架封装的Request对象和Response对象 onProxyRes的第一个参数proxyRes则是 node http.IncomingMessage的实例,内置的方法及属性都有所不同 URL |
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |