Answer the question
In order to leave comments, you need to log in
How to setup webpack-dev-server proxy?
Good afternoon. The server is on port 3001, the client is on 8080.
How do I set up a proxy for api access? I use axios, the request itself looks like this:
componentDidMount() {
axios.get('/api/clients')
.then(function (res) {
console.log(res);
})
.catch(function (err) {
console.log(err);
});
}
"proxy": "http://localhost:3001/"
, I devServer: {
proxy: [{
path: '/api/',
target: 'http://localhost:3001'
}],
historyApiFallback: true
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question