unjs / h3

⚡️ Minimal H(TTP) framework built for high performance and portability
https://h3.unjs.io/
MIT License
3.68k stars 218 forks source link

Server middleware cookies on initial page serve in nuxt 3 #406

Closed githubnikola closed 1 year ago

githubnikola commented 1 year ago

Environment

node: 18.12.0 nuxt: 3.3.2

Reproduction

Make a server/middleware where you set a cookie. Request homepage. In homepage script setup call useFetch to fetch some data from /server/api.

Describe the bug

Both requests mentioned in reproduction section go through server/middleware but the later one does not have a cookie previously set.

I assume this is not a bug, but am running out of options on the internet on how to set a cookie on initial request that will persist throughout all requests.

Additional context

No response

Logs

No response

Hebilicious commented 1 year ago

Hi @githubnikola, could you open an issue in the nuxt repo to better track this please ? Also, please provide a stackblitz/repo 🙏