Skip to content

Latest commit

 

History

History
30 lines (16 loc) · 996 Bytes

README.md

File metadata and controls

30 lines (16 loc) · 996 Bytes

Issue: SvelteKit headers not set in production build when ssr = false

Reproduction

  1. Create SvelteKit skeleton project

  2. Set headers in hooks.server.ts

export const handle: Handle = async ({ event, resolve }) => {
event.setHeaders({
'x-foo': 'bar',
'cache-control': 'no-store',
})
return resolve(event)
}

  1. Disable SSR:

export const ssr = false

  1. pnpm build
  2. pnpm preview
  3. Get headers (https -h http://127.0.0.1:4173/)
  4. Note the missing headers

https -h http://127.0.0.1:4173/

NB

  1. In this reproduction I used adapter-auto, but behavior is the same with adapter-node
  2. The headers are present in dev mode (pnpm dev):

pnpm dev