Skip to content

Performance: embedded static assets served with no cache validators or Cache-Control #71

Description

@LarsLaskowski

Source: Full code review 2026-07-17 (docs/reviews/2026-07-17-full-code-review.md), finding F14.
Category: performance · Severity: low · Effort: small

Problem

Files served from embed.FS have a zero ModTime, so http.FileServerFS (internal/web/embed.go:15-21) emits no Last-Modified/ETag, and no Cache-Control header is set — every page load refetches all assets. Harmless on a LAN, but wasteful, and any heuristically-caching intermediary could serve stale JS after an upgrade with no validator to revalidate against.

Suggested fix

Wrap the file server to set Cache-Control: no-cache plus a version-derived ETag (e.g. the build version string, already available via main.version) so browsers revalidate cheaply and always get fresh assets right after an upgrade.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions