Description
- This is a bug
- This is a modification request
Code
devServer: {
proxy: {
'/api': {
target: 'dummy', // shouldn't be necessary
router: request => ...
},
},
},
Expected Behavior
I expect to be able to use the router
feature of http-proxy-middleware
without having to specify a target
.
Actual Behavior
When target
is missing, the proxy middleware is not used at all:
webpack-dev-server/lib/Server.js
Lines 281 to 283 in 516d7b1
Which is also noted in the documentation:
Note that some of
http-proxy-middleware
's features do not require atarget
key, e.g. itsrouter
feature, but you will still need to include atarget
key in your configuration here, otherwisewebpack-dev-server
won't pass it along tohttp-proxy-middleware
).
Recently, the validation in http-proxy-middleware
has been updated to allow for configurations without a target
key. I suggest to do the same here and extend the condition to proxyConfig.target || proxyConfig.router
.