Using Surge’s automatic Lucid Caching

When you publish to Surge, a strategy we call Lucid Caching is automatically applied:

  1. Gzip is enabled for all appropriate content types
  2. Far-future expiry headers are properly set

Every asset, including HTML, is served with the following Cache-Control directive, and an ETag validator:

Cache-Control: public, max-age=31536000, no-cache
ETag: "0f31201287e0e3f7e87c86ed26f2a492"

This tells your visitors’ browsers they may store the asset for a year, but must validate the cache before serving it.

Surge then uses ETags to force the cache validation, ensuring the client doesn’t serve a stale asset. This means:

  • The browser never downloads the same asset twice—not even .html files.
  • The server never serves a stale file.
  • The developer never has to rename files, or change asset paths to cache bust.
  • The end-user’s browser cache is not abused.

As far as we’re aware, this is the most aggressive front-end caching strategy that can be put together without ever serving stale content. It’s applied automatically when you publish with Surge.

Questions? We’re on Twitter at @surge_sh, or in chat.