Gzip the text responses
Nothing was compressed: the list page shipped ~123 KB of HTML, CSS and JS in the clear on every cold load, which is the wrong bill for a phone on mobile data. A stdlib middleware compresses the four content types this server actually serves in bulk and leaves woff2 alone, since it is already compressed. Measured on the live server: style.css 21.8 KB -> 6.5, htmx 50.9 -> 16.4, filter.js 7.6 -> 2.9. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -179,7 +179,7 @@ func newRouter(store *Store, cfg Config) http.Handler {
|
||||
web.register(mux)
|
||||
}
|
||||
|
||||
return withCORS(cfg.AllowedOrigins, guardEmptyUserscriptToken(mux))
|
||||
return withCORS(cfg.AllowedOrigins, withGzip(guardEmptyUserscriptToken(mux)))
|
||||
}
|
||||
|
||||
// guardEmptyUserscriptToken heads off ServeMux's own path-cleaning redirect:
|
||||
|
||||
Reference in New Issue
Block a user