Adding cookies on ssr response
I recently had a use case for setting cookies on the server side. As far as I understood it: If we fetch (e.g. with useFetch) from an internal api during ssr, the cookies etc. wont be forwarded due to an internal function call instead of a fetch call for performance reasons. But the client headers have to exist on the initial request to the nuxt backend, right ? Why can't they be forwarded internally with the function call ? Is there some kind of security risk ?
It got even more complicated when trying to set-cookies in the ssr response:
https://nuxt.com/docs/getting-started/data-fetching#pass-cookies-from-server-side-api-calls-on-ssr-response
Cant this be simplified ?
Nuxt
Data fetching · Get Started with Nuxt
Nuxt provides composables to handle data fetching within your application.
0 Replies