So i'm making a API call with a proxy like this:
vue.config.js:
module.exports = {
devServer: {
proxy: 'http://www.pathofexile.com/'
}
}
xxx.vue:
axios.get("http://localhost:8080/api/public-stash-tabs").then..
This works! Now when i want to make a API call from a different site as well i'm not sure how to do it. Something like this is what i want:
vue.config.js:
module.exports = {
devServer: {
proxy: {
'http://localhost:8080/one/': {
target: 'http://www.pathofexile.com/',
changeOrigin: true
},
'http://localhost:8080/two/': {
target: 'https://api.poe.watch/',
changeOrigin: true
}
}
}
}
xxx.vue:
axios.get("http://localhost:8080/one/api/public-stash-tabs").then..
axios.get("http://localhost:8080/two/id").then..
But nothing is happening it seems, i'm getting an 404 error because it tries to get something from http://localhost:8080/api/public-stash-tabs
Am i on the right track with this and am i just missing something? Or is this not the way to go?