Reputation: 608
I'd like that when i try to access this URL :
http://localhost:8080/123456/activites-digitales
Proxy redirect request to this address :
http://localhost:8082/activites-digitales
I have an api on port 8082 which return JSON.
With my current config file it work for :
http://localhost:8080/activites-digitales
But not :
http://localhost:8080/123456/activites-digitales
123456 could be any number, it's a route parameter, what should i change in my configuration ?
I've got the following devServer conf :
devServer: {
hotOnly: true,
index: 'index.html',
port: 8080,
proxy: {
'/activites-digitales': 'http://localhost:8082/'
}
}
I ever tried '*/activites-digitales', '/**/activites-digitales'
webpack and webpack-dev-server 2.3
Upvotes: 1
Views: 4955
Reputation: 84
You can use the pathRewrite config like the below:
proxy: {
"/123456/activites-digitales": {
target: "http://localhost:8082/",
pathRewrite: {"^/123456": ""}
}
}
More info here
Upvotes: 3
Reputation: 1455
You are redirecting your host port 8080 to port 8082 in your code.
http://localhost:8082/
Upvotes: 0