diff --git a/packages/nuxt3/src/app/composables/ssr.ts b/packages/nuxt3/src/app/composables/ssr.ts index f4fcf88309..9cd19c3801 100644 --- a/packages/nuxt3/src/app/composables/ssr.ts +++ b/packages/nuxt3/src/app/composables/ssr.ts @@ -7,5 +7,5 @@ export function useRequestHeaders (include?) { if (process.client) { return {} } const headers: Record = useNuxtApp().ssrContext?.req.headers ?? {} if (!include) { return headers } - return Object.fromEntries(include.map(key => [key, headers[key]])) + return Object.fromEntries(include.filter(key => headers[key]).map(key => [key, headers[key]])) }