[traefik] Add global compress middleware to fix response compression

The rewrite-body plugin (rybbit analytics, anti-AI trap links) requires
strip-accept-encoding to work, which killed HTTP compression for 50+
services. This adds Traefik's built-in compress middleware at the
websecure entrypoint level to re-compress responses to clients after
rewrite-body has modified them.

Uses includedContentTypes whitelist (not excludedContentTypes) so only
text-based types are compressed. SSE, WebSocket, gRPC, and binary
downloads are unaffected.

Measured improvement on ha-sofia:
- app.js: 540KB → 167KB (3.2x)
- core.js: 52KB → 19KB (2.7x)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Viktor Barzin 2026-04-16 22:18:51 +00:00
parent e80b2f026f
commit 4c8e5bea0b
2 changed files with 54 additions and 1 deletions

View file

@ -33,7 +33,7 @@ resource "helm_release" "traefik" {
values = [yamlencode({
deployment = {
replicas = 3
replicas = 3
terminationGracePeriodSeconds = 60
lifecycle = {
preStop = {
@ -123,6 +123,9 @@ resource "helm_release" "traefik" {
tls = {
enabled = true
}
middlewares = [
"traefik-compress@kubernetescrd",
]
}
http3 = {
enabled = true