\r\n \u003Cbutton @click=\"handleError\">Clear error\u003C/button>\r\n \u003Cbr />\r\n \u003CNuxtLink to=\"/404\"> Trigger another error \u003C/NuxtLink>\r\n \u003Cbr />\r\n \u003CNuxtLink to=\"/\"> Navigate home \u003C/NuxtLink>\r\n \u003C/div>\r\n \u003C/div>\r\n\u003C/template>\r\n\r\n\u003Cscript setup>\r\nconst router = useRouter();\r\nconst props = defineProps({ error: Object });\r\n\r\nif (router.currentRoute.value.fullPath === \"/old-slug\") {\r\n await navigateTo(\"/new-slug\", {\r\n redirectCode: 301,\r\n });\r\n}\r\n\r\nconst handleError = () => clearError({ redirect: \"/\" });\r\n\u003C/script>\r\n\r\n\r\n```\r\n\r\n### Describe the bug\r\n\r\nWhen i curl this url :\r\n\r\n```\r\n$ curl http://192.168.0.117:3000/old-slug -v\r\n...\r\n* Mark bundle as not supporting multiuse\r\n\u003C HTTP/1.1 301 Moved Permanently\r\n\u003C Access-Control-Allow-Origin: *\r\n\u003C location: /new-slug\r\n\u003C content-type: text/html\r\n\u003C server-timing: -;dur=0;desc=\"Generate\"\r\n\u003C date: Wed, 30 Nov 2022 18:25:24 GMT\r\n\u003C connection: close\r\n\u003C content-length: 95\r\n\u003C \r\n* Closing connection 0\r\n\u003C!DOCTYPE html>\u003Chtml>\u003Chead>\u003Cmeta http-equiv=\"refresh\" content=\"0; url=/new-slug\">\u003C/head>\u003C/html>\r\n```\r\n\r\n**everything works correctly except get this error on server:**\r\n\r\n\r\n```\r\n[nitro] [dev] [unhandledRejection] Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client\r\n at new NodeError (node:internal/errors:387:5)\r\n at ServerResponse.setHeader (node:_http_outgoing:644:11)\r\n at Object.errorhandler [as onError] (/nuxt3test/nuxt-app/.nuxt/dev/index.mjs:427:20)\r\n at Server.toNodeHandle (/nuxt3test/nuxt-app/node_modules/h3/dist/index.mjs:752:27)\r\n at processTicksAndRejections (node:internal/process/task_queues:96:5) {\r\n code: 'ERR_HTTP_HEADERS_SENT'\r\n}\r\n\r\n```\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3090,3091,3092],{"name":3037,"color":3038},{"name":3021,"color":3022},{"name":3062,"color":3063},15738,"Error [ERR_HTTP_HEADERS_SENT]: Cannot set headers after they are sent to the client","2024-07-29T21:23:36Z","https://github.com/nuxt/nuxt/issues/15738",0.6621982,{"description":3099,"labels":3100,"number":3103,"owner":3027,"repository":3027,"state":3041,"title":3104,"updated_at":3105,"url":3106,"score":3107},"### Environment\r\n\r\n------------------------------\r\n- Operating System: Windows_NT\r\n- Node Version: v20.11.1\r\n- Nuxt Version: 3.12.4\r\n- CLI Version: 3.12.0\r\n- Nitro Version: 2.9.7\r\n- Package Manager: npm@10.2.4\r\n- Builder: -\r\n- User Config: compatibilityDate, devtools, modules, tailwindcss, css, routeRules, vite, nitro, runtimeConfig, app, fontLoader\r\n- Runtime Modules: @pinia/nuxt@0.5.2, @nuxtjs/tailwindcss@6.12.1, @nuxtjs/eslint-module@4.1.0, nuxt-font-loader@2.3.5, nuxt-swiper@1.2.2\r\n- Build Modules: -\r\n------------------------------\r\n\r\n### Reproduction\r\n\r\n[link](https://stackblitz.com/edit/github-mmb9rv?file=app.vue)\r\n\r\n### Describe the bug\r\n\r\n```js\r\n// Cookies are being set\r\nexport default defineEventHandler(async (event) => {\t\r\n\tsetCookie(event, 'token', '123', { maxAge: 60 * 60 * 24 * 7, path: '/' });\r\n\treturn ;\r\n});\r\n\r\n// Cookies are not set\r\nexport default defineEventHandler(async (event) => {\t\r\n\tsetCookie(event, 'token', '123', { maxAge: 60 * 60 * 24 * 7, path: '/' });\r\n\treturn 'response';\r\n});\r\n\r\n//In both cases I get the contents of set-cookie\r\nconst { data, error } = await useFetch('/api/settings/get', {\r\n\tonResponse({ request, response, options }) {\r\n\t\tconst headers = response.headers;\r\n\r\n\t\tconst cookie = headers.get('set-cookie');\r\n\r\n\t\tif (cookie) {\r\n\t\t\tconsole.log('COOKIE:', cookie);\r\n\t\t}\r\n\t}\r\n});\r\n```\r\n\r\n\r\n### Additional context\r\n\r\n_No response_\r\n\r\n### Logs\r\n\r\n_No response_",[3101,3102],{"name":3021,"color":3022},{"name":3062,"color":3063},28404,"Cookies are not set if there is data in the response","2025-03-24T12:05:23Z","https://github.com/nuxt/nuxt/issues/28404",0.6626098,{"description":3109,"labels":3110,"number":3112,"owner":3027,"repository":3027,"state":3041,"title":3113,"updated_at":3114,"url":3115,"score":3116},"### Environment\n\n- Operating System: `Windows_NT`\n- Node Version: `v22.9.0`\n- Nuxt Version: `3.16.1`\n- CLI Version: `3.23.1`\n- Nitro Version: `2.11.8`\n- Package Manager: `npm@10.8.3`\n- Builder: `-`\n- User Config: `compatibilityDate`, `devtools`\n- Runtime Modules: `-`\n- Build Modules: `-`\n\n### Reproduction\n\nstackblitz:\nhttps://stackblitz.com/~/github.com/RifatMahmudno-1/nuxt-cookie-error\n\nGithub Repo:\n[https://github.com/RifatMahmudno-1/nuxt-cookie-error](https://github.com/RifatMahmudno-1/nuxt-cookie-error)\n\nFor better reproduction\n1. Build it `npm run build`\n2. Preview `npm run preview`\n3. Delete all previous cookies and refresh the browser window.\n\n### Describe the bug\n\nWhen `useFetch` or `useLazyFetch` makes a request to any server route that sets cookies, those cookies aren't sent back to the browser, meaning the cookies aren't actually set. I think this bug needs to be fixed quickly.\n\n### Additional context\n\n_No response_\n\n### Logs\n\n```shell-script\n\n```",[3111],{"name":3021,"color":3022},31549,"Doesn't set cookie in SSR","2025-03-27T11:25:39Z","https://github.com/nuxt/nuxt/issues/31549",0.6663517,{"description":3118,"labels":3119,"number":3123,"owner":3027,"repository":3027,"state":3041,"title":3124,"updated_at":3125,"url":3126,"score":3127},"### Environment\r\n\r\n- Operating System: `Linux`\r\n- Node Version: `v19.7.0`\r\n- Nuxt Version: `3.2.3`\r\n- Nitro Version: `2.2.3`\r\n- Package Manager: `npm@9.6.0`\r\n- Builder: `vite`\r\n- User Config: `ssr`, `css`, `modules`\r\n- Runtime Modules: `@nuxtjs/tailwindcss@6.4.1`, `nuxt-icons@3.1.0`\r\n- Build Modules: `-`\r\n\r\n\r\n### Reproduction\r\n\r\n```\r\n\u003Cscript setup>\r\ndefinePageMeta({layout: \"guest\",});\r\nconst any = await useFetch('http://localhost:8080/test') // response with cookies, but cookie tab in devtools is empty\r\n\u003C/script>\r\n```\r\n\r\n### Describe the bug\r\n\r\ncookies dont set\r\n\r\n### Additional context\r\n\r\nLocal development\r\nBackend: php (laravel) - localhost:8080\r\nFrontend: nuxt - localhost:3000\r\nssr:false\r\ninside devTools in the response section I see that the cookie headers are there, but they are not set, why?\r\n\r\n### Logs\r\n\r\n_No response_",[3120,3121,3122],{"name":3037,"color":3038},{"name":3021,"color":3022},{"name":3062,"color":3063},19432,"Cookies are not set","2023-03-03T18:26:00Z","https://github.com/nuxt/nuxt/issues/19432",0.6691585,{"description":3129,"labels":3130,"number":3133,"owner":3027,"repository":3027,"state":3041,"title":3134,"updated_at":3135,"url":3136,"score":3137},"### Environment\r\n\r\n- Operating System: Linux\r\n- Node Version: v18.18.0\r\n- Nuxt Version: 3.10.3\r\n- CLI Version: 3.10.1\r\n- Nitro Version: 2.9.1\r\n- Package Manager: npm@10.2.3\r\n- Builder: -\r\n- User Config: devtools\r\n- Runtime Modules: -\r\n- Build Modules: -\r\n\r\n### Reproduction\r\n\r\nhttps://stackblitz.com/edit/github-fatzbc?file=plugins%2Findex.server.ts\r\n\r\n### Describe the bug\r\n\r\nThis issue may not be a bug and just a question whether or not the logic behind is intentional.\r\n\r\nThe reproduction has a server plugin that updates the value of a cookie on the ssr request. Then a page redirection is performed which re-creates the nuxtApp and thus re-runs the plugin. On the second invocation of the plugin the expected cookie value is the one set by the first invocation. This is true if the redirection page exists. If not, the cookie value set on the first invocation is lost and replaced by the original value on the ssr request.\r\n\r\n\r\n### Additional context\r\n\r\nhttps://github.com/becem-gharbi/nuxt-directus/issues/76#issuecomment-1981669909\r\n\r\n### Logs\r\n\r\n1- load index page `/`, the server redirects to found page `/found`. The cookie is updated.\r\n\r\n```\r\n***** route is / *****\r\nincoming cookie cookie=4;\r\n\r\n***** route is /found *****\r\nincoming cookie cookie=5;\r\n```\r\n2- load non-existant page `/not-found`. The cookie is not updated.\r\n```\r\n***** route is /not-found *****\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\nincoming cookie cookie=6;\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\n\r\n***** route is /not-found *****\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\n[Vue Router warn]: No match found for location with path \"/not-found\"\r\nincoming cookie cookie=6;\r\n```\r\n",[3131,3132],{"name":3037,"color":3038},{"name":3021,"color":3022},26126,"[question] cookie update on ssr error","2024-03-11T11:51:57Z","https://github.com/nuxt/nuxt/issues/26126",0.6729642,["Reactive",3139],{},["Set"],["ShallowReactive",3142],{"$fTRc1wZytZ_XrK4EfJfei_Sz-An4H4Yy6syhVxH_PVJc":-1,"$fp5TxhqZKeqk6rpIx7wYoGL13EZKigoMwLdLfgbu_KwY":-1},"/nuxt/nuxt/32472"]