Description
Is your feature request related to a problem? Please describe.
A lot of people prefer using routeRules
to proxy their Nuxt requests to the remote API, but usually it has problems with passing headers/cookies and can result in unexpected behaviour.
Describe the solution you'd like
It would be nice to provide a collection of Nuxt server API routes that can be used instead of the remote server to handle this with full support of CSRF/Headers/cookies and other parameters to pass it from the client request and then back from the Laravel API.
It can be just one single route that proxies everything. However, that requires proper testing with different scenarios and possible user customisation.
This configuration should be optional since it won't work for CSR-only applications. Probably, we can reuse an approach used for globalMiddleware
, which is not loaded if not enabled in the config.
Describe alternatives you've considered
Provide a complete guide on the usage of routeRules
with a remote server.
Additional context
Related to:
- [Question] You must pass your app key when you instantiate Pusher. nuxt-laravel-echo#115
- Could not convert argument of type symbol to string #183
- Refreshing page that makes use of laravel-echo loggs out the user #113
- [Bug] No
Accept: application/json
header in request #106 - [Docs] Keep client headers during SWR mode #94
- [Bug] Authenticated user redirected to login & home when refreshing the page #37