解決方法
打開 node_modules\http-proxy\lib\http-proxy\common.js
106行回車添加一下代碼,就能打印代理的地址
console.log('proxy:',outgoing.headers.host,outgoing.port,outgoing.path)
源碼分析
找了半天webpack的debug開啟方法,如下
debug: true,
plugins: [
new webpack.LoaderOptionsPlugin({
debug: true
})
]
然而并沒有什么用,沒見debug日志
只能用最原始的console.log()
debug了
vue proxyTable
是基于 webpack-dev-server
實(shí)現(xiàn)的
webpack-dev-server
是基于 express
實(shí)現(xiàn)的
express
代理功能是通過 http-proxy-middleware
實(shí)現(xiàn)的
http-proxy-middleware
代理功能是通過http-proxy
包實(shí)現(xiàn)的
定位 http-proxy
中處理url的 js
所以console.log
加在http-proxy
的common.js
中