Static GitHub Issues

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

prev: Need docs improvement for asyncData method.
next: How to set 404 statusCode for current page?

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/${id})

Thanks.

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2397">#c2397</a>)</em></sub></div>