Skip to content
runlot

Caching and compression

What the platform does to your responses on the way out — compression, the cache header on static assets, and the one case where it rewrites an HTML page's cache headers.

Your worker's response reaches the visitor through Runlot's front end. The front end leaves your headers alone except in the cases on this page.

Compression

When the visitor accepts it, the front end compresses your response with Brotli, or with gzip when Brotli is not accepted. This covers worker responses and static assets.

  • What is compressed: text types (HTML, CSS, plain text, CSV), JSON, JavaScript, XML, SVG, WebAssembly and web manifests.
  • What is left alone: responses other than 2xx, 206 partial responses, HEAD requests, images, WOFF/WOFF2 fonts, video, audio, archives, text/event-stream, and any body known to be under 1 KB.
  • Your own encoding wins. A response that already has a Content-Encoding, or whose Cache-Control says no-transform, goes out exactly as your worker sent it.

A compressible response gets Vary: Accept-Encoding appended to whatever Vary you set, so a shared cache keeps the compressed and uncompressed forms apart. A compressed response loses its Content-Length, and a strong ETag becomes weak (W/"…"), because the bytes are no longer the bytes the validator named. Streamed bodies are compressed as they arrive; the front end does not wait for the end.

You do not need to compress in your worker. If you do, the front end passes your encoding through.

Static asset caching

Files served from your assets directory carry one of two Cache-Control values:

FileCache-Control
A hashed name such as index-D1GCrTMx.js or app.3f9a1c2e.csspublic, max-age=31536000, immutable
Anything under /_next/static/ (Next.js) or /_app/immutable/ (SvelteKit)public, max-age=31536000, immutable
Everything elsepublic, max-age=300

A hashed name is a run of eight or more letters, digits, _ or - right before the extension and after a - or .. A file whose content can change under the same name, such as logo.svg or big.js, is kept for five minutes. Each asset also carries a weak ETag and Last-Modified, so a revalidation is answered with 304 Not Modified and no body.

HTML pages with browser error capture

On Pro, Runlot Errors collects browser errors, Web Vitals and session replays by adding one <script> tag before </head> of your HTML pages. The tag carries a token for that single page view, so a page that received it is changed in two ways:

  • Cache-Control becomes private, no-store, whatever your worker set.
  • ETag, Last-Modified, Expires and Pragma are removed.

This keeps a shared cache from handing one visitor's page, and its token, to the next visitor.

The tag is not added, and your headers are left exactly as you set them, when any of these is true:

  • The response is not text/html, the request is not a GET or POST, or the status is a redirect, 204, 206 or 304.
  • The response has a Content-Encoding (it is already compressed), or Cache-Control: no-transform.
  • The response is an attachment (Content-Disposition: attachment).
  • A Content-Security-Policy would block a same-origin script, or uses a nonce, a hash or strict-dynamic.
  • The page has a <base href> or a <meta http-equiv="Content-Security-Policy"> in its head.
  • The path matches one of the project's excluded routes.

Keeping your own cache headers on HTML

To keep a page cacheable by a CDN or shared cache, choose one of these:

  • Exclude the route. In the dashboard, open the project's Errors → Settings, and under Error capture and privacy add the path to browserExcludedRoutes (for example /blog/*, up to 50 paths). The change applies without a deploy. Browser errors are not collected on those paths.

  • Turn browser capture off for the project in runlot.json:

    runlot.json
    { "observability": { "browser": false } }
  • Send Cache-Control: no-transform on the pages you want left alone.

Server-side errors, logs and request records are not affected by any of these.

On this page