Update:
thanks to @chimurai, setting changeOrigin: true
is important to make it work.
Underneath webpack-dev-server
passes all the proxy configuration to http-proxy-middleware
, from the documentation. It's clear the use case you want is actually achieved with /v1/**
path:
devServer: {
historyApiFallBack: true,
// progress: true,
hot: true,
inline: true,
// https: true,
port: 8081,
contentBase: path.resolve(__dirname, 'public'),
proxy: {
'/v1/**': {
target: 'http://api.in.uprintf.com',
secure: false,
changeOrigin: true
}
}
},
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…