In my vue-app I'm using the @nuxtjs/proxy together with @nuxtjs/axios but for some reason I don't know, I always get an Request failed with status code 404 -error when calling the api.
Here is my nuxt.config.js
modules: [
'@nuxtjs/axios',
'@nuxtjs/proxy'
],
axios: {
proxy: true,
},
proxy: {
"/api": {
target: "https://url-to-api.com/api",
pathRewrite: { "^/api/": "" },
}
},
then in my vue-component
created(){
const { data } = await this.$axios.get(
`/api/products/all`
)
...
}
when I check on the network tab, the request is:
https://mypage.com/api/products/all
that request returns like mentioned above Request failed with status code 404
What am I doing wrong?