Skip to content

Recognize fingerprinted CSS and font assets for immutable caching in Void Pages #881

Open

Description

@karthickeyan-dev

A browser can reuse a content-addressed stylesheet or font across page loads. In a Void Pages app where global middleware sends asset requests through the Worker, these files keep Cloudflare’s default revalidation policy. A repeat full load can therefore make another Worker request for each file it revalidates.

What I checked

With void@1.11.0, inspect dist/client/.vite/manifest.json after a production build that imports CSS and emits a font file (for example, a WOFF2 above Vite’s inline limit). Compare the emitted paths in file, css and assets with the union of all immutableFiles lists. In our local build:

Extension Files referenced Listed as immutable
JS 176 176
CSS 2 0
WOFF2 29 0
SVG 1 0

The native Cloudflare deployment guide explicitly describes the current CSS behavior. The manifest code explains why it only stamps chunks: a stable output asset name can resemble a hashed name. The Worker consults the stamped paths when applying its immutable response policy.

Request

Extend the policy to emitted CSS, fonts and other assets when the build can establish that their URLs change with their contents. Keep ordinary revalidation for stable filenames, including copied public files, and preserve explicit Cache-Control rules. If the bundler does not expose enough provenance today, an explicit build-time opt-in for known fingerprinted outputs would also help.

This applies even when the Worker intentionally handles the request. Middleware path matching is tracked separately in #808.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions