Skip to content

fix: serve static files with the Content-Type recorded in the manifest - #16564

Merged
Rich-Harris merged 2 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-adapter-node-mime-types
Jul 30, 2026
Merged

fix: serve static files with the Content-Type recorded in the manifest#16564
Rich-Harris merged 2 commits into
sveltejs:version-3from
Nic-Polumeyv:fix-adapter-node-mime-types

Conversation

@Nic-Polumeyv

Copy link
Copy Markdown
Contributor

Picks up the adapter-node half of #13753.

#16234 fixed .ico by adding mimes['ico'] to the shared mrmime module. That works in dev and preview, which share one instance with sirv. adapter-node bundles its own copy of mrmime through sirv, so the patch never reaches it and .ico still goes out with an empty Content-Type in production.

The manifest already records the right type at build time, resolved through the patched lookup, so this reads it back rather than relying on sirv's copy.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Jul 29, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 31f8060:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/31f8060356a464827a50377fc5df2fd9a980728b

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/16564

Note

This PR is from a fork. A maintainer must approve approve each commit before it can be built and installed.

@changeset-bot

changeset-bot Bot commented Jul 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 31f8060

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@sveltejs/adapter-node Patch
@sveltejs/kit Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@Rich-Harris
Rich-Harris merged commit 08d7e2a into sveltejs:version-3 Jul 30, 2026
21 of 22 checks passed
Rich-Harris added a commit that referenced this pull request Jul 30, 2026
…ecompressed (#16566)

The remaining half of #10343, and the first concrete piece of #16565.

#15182 stopped the header when `precompress` is `false`. It still goes
out on every asset when `precompress` is `true`, because `sirv` sets
`Vary` from its options rather than from the file, while
`builder.compress` only compresses a fixed extension list. So a `.ico`
or a `.png` advertises a variant that was never produced.

Only extensions that were written but never compressed lose the header,
since `setHeaders` sees the request pathname, not the file `sirv`
resolved, and `/` or `/v1.0` may be serving `index.html.gz`.

Commits are separated by layer so the kit-side and adapter-side changes
can be reviewed apart.

This rewrites the same `setHeaders` block as #16564, so whichever lands
first, the other needs a rebase.

---------

Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
@Nic-Polumeyv
Nic-Polumeyv deleted the fix-adapter-node-mime-types branch July 30, 2026 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants