Skip to content

QuizNot attempted

Long-caching the HTML

A team sets Cache-Control: public, max-age=31536000 on index.html too, to make repeat visits faster. What goes wrong?
1–4 to choose, Enter to submit
Show answer & explanation

Correct answer:

  • Returning visitors keep the old HTML, which points at the old chunks, so they don't see new deploys for up to a year
  • The HTML is what tells the browser which hashed files to load.
  • If the browser may reuse it for a year without asking, it keeps loading the old chunks, and you can't purge a user's browser cache from the server.
  • Not "nothing": hashing only helps if the HTML that names the files is fresh.
  • Not "refuses": browsers honour long max-age on HTML.
  • Not "browsers always revalidate HTML": they follow the headers
  • a normal navigation reuses fresh cached HTML.