0👍
✅
Apparently the only way to solve this is by using a proxy on the localhost devserver.
The "solution" is in vue.config.js
adding:
devServer: {
proxy: {
'/woocommerce': {
target: 'https://woocommercewebsite.com/',
changeOrigin: true,
pathRewrite: {
'^/woocommerce': ''
}
}
},
...
And in axios query https://localhost:8080/woocommerce/
which will route the request to the external server.
Why can I query other REST APIs on the internet from the same localhost app but not Woocommerce? Maybe someone can explain this.
Source:stackexchange.com