-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
- Operating System:
- Node Version:
- NPM Version:
- webpack Version:
- webpack-dev-server Version: 3.10.3
- Browser:
- This is a bug
- This is a modification request
Code
When using the 'context': 'target' or 'context': { ...options... } style of proxy, if /* is at the end of the context it is removed.
webpack-dev-server/lib/Server.js
Lines 230 to 233 in 50c09a4
| // For backwards compatibility reasons. | |
| const correctedContext = context | |
| .replace(/^\*$/, '**') | |
| .replace(/\/\*$/, ''); |
See discussion in #359 for why this was done
So, for a config such as this:
// webpack.config.js
module.exports = {
//...
devServer: {
proxy: {
'/api/*' : 'http://localhost:3000'
}
}
};Expected Behavior
Proxies everything starting with /api/
i.e. /api/stuff but NOT /apistuff.html
Actual Behavior
Proxies everything starting with /api
including /apistuff.html
For Bugs; How can we reproduce the behavior?
- Create new project using The SAFE Template:
dotnet new SAFE - To make it clear when requests are being proxied to the server, replace
use_static publicPathwithuse_router (text "from server")insrc/Server/Server.fs - Run the project using
fake build -t run - Observe that localhost:8080/apistuff.html results in
from server, because it is being proxied to the server (whereas localhost:8080/notapistuff.html results inCannot GET /notapistuff.htmlbecause it is not being proxied)
For Features; What is the motivation and/or use-case for the feature?
N/A