Files
ARTEX/server
Pedro Gomes 0c05ec7204 webui: add ETag + gzip + immutable caching to the embedded SPA handler
The embedded Next export ships ~1.55 MB of JS/CSS. Files read from embed.FS
report a zero modtime, so http.ServeFileFS emitted no Last-Modified and nothing
set an ETag: the browser had no validator and re-downloaded the whole bundle on
every page load. The handler also ignored Accept-Encoding, so those bytes went
out uncompressed.

Measured from a 211 ms-RTT link: 17 assets / 1,554,053 B, 8.57 s serialised,
1.98 s at 6-way parallelism, 0.28 MB/s per SSH stream.

Now each asset is digested (sha256, 16 bytes, quoted strong ETag) and, for
compressible types over 1 KiB, gzipped once at BestCompression and cached in
memory (~450 KB total). Responses carry Vary: Accept-Encoding and honour
gzip;q=0. /_next/static/* gets public, max-age=31536000, immutable because
Next content-hashes those filenames; HTML gets no-cache so a rebuild is never
served stale. Range and HEAD still work (http.ServeContent underneath).

Stdlib only, no new module dependencies.

(cherry picked from commit 8ad714c606e69674e991c0e80da61c2c7a708c22)
2026-11-20 08:46:47 +00:00
..
2026-07-26 04:27:45 -04:00
2026-07-26 04:27:45 -04:00
2026-08-24 14:14:15 +08:00
2026-10-23 18:12:38 -03:00
2026-08-25 12:05:26 +08:00
2026-08-25 12:05:26 +08:00