Skip to content

QuizNot attempted

Header for a hashed chunk

Which Cache-Control header suits /assets/index-BFP5p68h.js, a content-hashed file from a Vite build?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • public, max-age=31536000, immutable
  • The URL is tied to the file contents, so it can never serve different code: caching it for a year (31536000 s) without revalidating is safe, and a deploy publishes new code under new names.
  • Not `no-cache`: that forces a round trip per file on every visit for nothing.
  • Not `no-store`: every visit would re-download every chunk.
  • Not `max-age=300`: it expires after 5 minutes and gets revalidated for no reason, since the file can never change.