Skip to content

feat(nginx): Cache static assets at the proxy, opt-in per domain#179

Merged
nfebe merged 1 commit into
mainfrom
feat/static-asset-caching
Jul 17, 2026
Merged

feat(nginx): Cache static assets at the proxy, opt-in per domain#179
nfebe merged 1 commit into
mainfrom
feat/static-asset-caching

Conversation

@nfebe

@nfebe nfebe commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

A deployment can now let the proxy set a long browser cache on its static assets (styles, scripts, images, fonts). It is off by default and enabled per domain.

The cache is keyed off the request path's extension, so it applies only to static files; dynamic and API responses are untouched and keep whatever cache headers the app already sets. Verified against real nginx: a .css response gets a 30-day Cache-Control, while a dynamic path that set its own no-store kept it.

This closes the serving-performance audit item on #158. The proxy-overhead baseline from that item, measured with keepalive pooling in place: the proxy adds about 0.05ms mean over hitting the container directly (p50 0.04 to 0.09ms, p95 0.07 to 0.17ms on loopback), so the proxy's own cost is negligible and not a bottleneck.

UI counterpart: flatrun/ui#85.

A deployment can now let the proxy set a long browser cache on its static assets
(styles, scripts, images, fonts). It is off by default and enabled per domain.

The cache applies only to responses whose path has a static extension, keyed off
the request path, so dynamic and API responses are untouched and keep whatever
cache headers the app already sets. Turning it on serves a repeat visitor's
static files from their browser instead of re-fetching them through the proxy.
@nfebe
nfebe merged commit 30dc5a6 into main Jul 17, 2026
6 checks passed
@nfebe
nfebe deleted the feat/static-asset-caching branch July 17, 2026 18:42
@nfebe nfebe mentioned this pull request Jul 19, 2026
42 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant