Home

Issue: 2762

How to proxy other API routes based on Nuxtjs "Auth Route" example

[issue link]

Hi,
I follow this example to creare Auth Route https://nuxtjs.org/examples/auth-routes (Look at the example files).

There are /login (/api/login) and /logout (/api/logout) routes in the example.

How can i proxy all routes except /login and /logout to another server. i mean every other routes (/api/*)

Examples:
/api/test -> http://myapi.tests/api/test
/api/project/1-> http://myapi.tests/api/project/1

In nuxt.config.js i have @nuxtjs/axios set up like this.

axios: {
baseURL: ‘/api’,
proxyHeaders: false
},

and call like this for example.
this.axios.get(/project/axios.get(`/project/{id}`)

Thanks.

This question is available on Nuxt.js community (#c2397)