Skip to content

Conversation

TorstenDittmann
Copy link
Contributor

@TorstenDittmann TorstenDittmann commented Sep 19, 2025

When serving client files, ensure non-immutable assets are never cached by browsers by setting a maxage=0 cache header.

When no cache-control header is set, browsers will still cache files and with /_app/version.json and /_app/env.js this causes a lot of issues when deploying new versions using the node adapter.

Similiar to what is done here https://github.com/sveltejs/kit/blob/main/packages/kit/src/runtime/server/respond.js#L291-L294

Related issues: #9089 #13799


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

Copy link

changeset-bot bot commented Sep 19, 2025

🦋 Changeset detected

Latest commit: 46c5757

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

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-node 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

@svelte-docs-bot
Copy link

Only static assets should be cached immutably. All other assets should
revalidate to ensure freshness.
@TorstenDittmann TorstenDittmann changed the title fix(node-adapter): set cache header for non-immutable assets fix(node-adapter): set cache header for non-immutable build assets Sep 19, 2025
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.

1 participant