Webpack config: https://gist.github.com/Khauri/ab21cd6a5a52caf178ecd148c10a408e
When navigating to a route with a dot in the URL, ie /.Hgvs_p1NQV4AFEoM5470ceQg/status the request should be passed on to the proxied server.
The request instead shows a default express 404 error page saying Cannot GET /.Hgvs_p1NQV4AFEoM5470ceQg/status, suggesting that some middleware is responding with a 404 before the request is sent to the proxied server.
This does not happen with a build, only when using webpack-dev-server.
~I can attempt to make a reproduction repo if necessary~
Reproduction repo: https://github.com/Khauri/webpack-dot-route-issue
It's possible that publicPath, contentPath, or other configs may be relevant as well, but I'm really not sure.
If this is an issue of webpack parsing dot urls as assets I think an ideal solution may be some kind of hook that lets you bypass that behavior by simply returning true or false.
I can attempt to make a reproduction repo if necessary
Please do it, otherwise I will close this issue
It is here, please take a look: https://github.com/Khauri/webpack-dot-route-issue
That explains it, thanks!
For anyone coming across this, I was able to fix it by changing the proxy config from:
proxy: {
'**': {
target: true,
router: () => 'http://127.0.0.1:8080',
}
}
to
proxy: [{
target: true,
context: () => true,
router: () => 'http://127.0.0.1:8080',
}]
Also, the context property does not seem to work unless it was wrapped in an array for some reason.
Most helpful comment
That explains it, thanks!
For anyone coming across this, I was able to fix it by changing the proxy config from:
to
Also, the context property does not seem to work unless it was wrapped in an array for some reason.