Can't configure devServer proxy many entries
See original GitHub issueVersion
3.0.0-beta.6
Reproduction link
Steps to reproduce
Set up two proxies in devServer configuration
{
'/api': {
target: 'http://localhost:9488',
pathRewrite: {'^/api/': '/api/'},
xfwd: true
},
'/auth': {
target: 'http://localhost:9485',
pathRewrite: {'^/auth/': '/auth/'},
xfwd: true
}
}
What is expected?
Both proxies should work.
What is actually happening?
It seems to configure the last entry only. In fact, it doesn’t seem that devServer supports an array of proxy definition , an associative object should be given.
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (3 by maintainers)
Top Results From Across the Web
How to configure a webpack proxy for multiple URLs efficiently?
I'm using webpack dev server to build ...
Read more >DevServer - webpack
Be aware that when exporting multiple configurations only the devServer options for the first configuration will be taken into account and used for...
Read more >devServer proxy(in vue.config.js) not working - Get Help
I encountered this problem, too. devServer proxy not working What should i do? vue.config.js exists in root dir of vue project.
Read more >webpack-dev-server
To the use inline mode specify --inline on the command line (you cannot specify it in the configuration). This adds the webpack-dev-server client...
Read more >Development Server - SurviveJS
devServer.proxy - If you are using multiple servers, you have to proxy WDS to them. The proxy setting accepts an object of proxy...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
you can write as follow devServer: { proxy: { ‘/getAbc|/getSde|/getCde’: { target: ‘http://127.0.0.1:3000/avc/’, }, ‘/initQwer’: { target: ‘http://127.0.0.1:3000/def’, }, ‘/getCvf’: { target: ‘http://127.0.0.1:3000/efd/’ } } }
@zimplexing 这里的 proxy 好像并不支持 webpack-dev-server 的 devServer.proxy写法 https://webpack.docschina.org/configuration/dev-server/#devserver-proxy