You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Static files served with Last-Modified = now() instead of the file mtime #1323
Every static file is served with Last-Modified set to SystemTime::now() rather than the file's real modification time. The header therefore changes on every request and carries no cache-validation information. There is also no ETag or Cache-Control, and the local-filesystem and database-filesystem "modified since" comparisons disagree (> vs >=), so conditional-request behavior differs by backend.
Observed (SQLPage v0.44.1), despite the file mtime being 2020-01-01:
last-modified: Fri, 12 Jun 2026 12:02:22 GMT
last-modified: Fri, 12 Jun 2026 12:02:23 GMT
The value is "now" and advances by one second between the two requests. A client doing If-Modified-Since revalidation can never get a meaningful answer, and caches cannot key on it.
The comparison contract also differs between backends: the local filesystem uses strict > (src/filesystem.rs#L254) while the database filesystem query uses >= (src/filesystem.rs#L303), so a file modified in the same second as the last check is treated differently depending on where it is stored.
Suggested fix
Set Last-Modified from the actual source mtime (the value is already read for cache validation in modified_since), or omit the header when the mtime is unknown. Pick one comparison contract (> or >=) and use it for both the local and DB filesystems. Optionally add ETag / Cache-Control for static assets while here.
Risk and mitigation
Low. Correct Last-Modified strictly improves caching and revalidation. The mtime is available for both local files (fs::metadata) and DB-backed files (the last_modified column on sqlpage_files), so no information is missing.
Activity
fix(http): Last-Modified is the file's mtime, not now()
81reap commentedon Oct 29, 2026
I think this is still an issue
Reproduction
On commit 616df27:
nix run .#reproduce -- repro_1323 postgres v0.35.0 v0.47.0 tree