perf(web): add gzip compression + cache-control headers for static assets
- Add CompressionLayer to web router for gzip compression of JS/CSS/JSON/SVG - Add Cache-Control header (7 days + stale-while-revalidate) via SetResponseHeaderLayer - Add 'set-header' feature to tower-http dependency - Result: 67-85% reduction in transfer size for all static assets
This commit is contained in:
+1
-1
@@ -13,7 +13,7 @@ tokio-stream = { version = "0.1.18", features = ["fs"] }
|
||||
bytes = "1.11.1"
|
||||
tempfile = "3.25.0"
|
||||
tower = "0.5.3"
|
||||
tower-http = { version = "0.6.8", features = ["fs", "compression-gzip", "trace", "cors", "add-extension", "request-id"] }
|
||||
tower-http = { version = "0.6.8", features = ["fs", "compression-gzip", "trace", "cors", "add-extension", "request-id", "set-header"] }
|
||||
flate2 = "1.1.9"
|
||||
zip = "=6.0.0"
|
||||
tracing = "0.1.44"
|
||||
|
||||
Reference in New Issue
Block a user