From a02f33e96e89f0d4a54d4d3253825ca42fb286a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Gra=CC=88fenstein?= Date: Sun, 22 Mar 2026 21:08:40 +0100 Subject: [PATCH] move text compression from Caddy to nginx for lower latency Nginx is closer to the origin, so compressing there avoids an extra hop. Removes the Caddy encode block for Nextcloud and adds gzip in nginx with level 4 targeting text, CSS, JS, JSON, XML, SVG. --- caddy/Caddyfile | 12 ------------ nextcloud/nginx.conf | 7 +++++++ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/caddy/Caddyfile b/caddy/Caddyfile index 88d6d30..1365c15 100644 --- a/caddy/Caddyfile +++ b/caddy/Caddyfile @@ -9,18 +9,6 @@ } nextcloud.t-gstone.de { - encode zstd gzip { - match { - header Content-Type text/* - header Content-Type application/javascript* - header Content-Type application/json* - header Content-Type application/xml* - header Content-Type application/rss* - header Content-Type application/atom* - header Content-Type image/svg* - } - } - reverse_proxy nextcloud-nginx:80 header Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" diff --git a/nextcloud/nginx.conf b/nextcloud/nginx.conf index 7796ddd..8cfba1c 100644 --- a/nextcloud/nginx.conf +++ b/nextcloud/nginx.conf @@ -20,6 +20,13 @@ server { application/javascript mjs; } + gzip on; + gzip_vary on; + gzip_comp_level 4; + gzip_min_length 256; + gzip_proxied any; + gzip_types text/plain text/css application/json application/javascript text/xml application/xml image/svg+xml; + client_max_body_size 10G; client_body_timeout 300s; fastcgi_buffers 64 4K;