From 4aeff3975632c459d2f13c301789ce8f4c2bf0e3 Mon Sep 17 00:00:00 2001 From: Mischa Date: Sat, 4 Jul 2026 23:12:27 +0200 Subject: [PATCH] fix(prod): stop garbage page from double Content-Encoding header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On this non-FastCGI host Grav's shutdown early-connection-close can't fastcgi_finish_request(), so it emits 'Content-Encoding: identity' to ask the webserver not to compress — but Apache mod_deflate compresses anyway and adds 'Content-Encoding: gzip'. Two conflicting headers => browsers render raw gzip bytes (garbage page). Surfaced when prod flipped to debug:false today (activated Grav's full output path). Fix in the prod env override: debugger.shutdown.close_connection:false skips the identity-header path so mod_deflate compresses cleanly (single header). Verified: one 'content-encoding: gzip', page renders correctly. Co-Authored-By: Claude Opus 4.8 Claude-Session: https://claude.ai/code/session_01Np4cMQLF77i664CAQXySzU --- deploy/env/prod/system.yaml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/deploy/env/prod/system.yaml b/deploy/env/prod/system.yaml index 4244eb6..a859bf9 100644 --- a/deploy/env/prod/system.yaml +++ b/deploy/env/prod/system.yaml @@ -18,3 +18,21 @@ twig: cache: true debug: false auto_reload: false + +# Compression / connection handling. +# +# This host is not FastCGI (no fastcgi_finish_request()), so Grav's shutdown +# "early connection close" falls back to emitting `Content-Encoding: identity` +# to ask the webserver not to compress. But Apache's mod_deflate compresses +# anyway and adds `Content-Encoding: gzip`, giving TWO conflicting headers — +# the browser can't decode the body and renders raw gzip bytes (a garbage +# page). Note: allow_webserver_gzip:true takes the SAME identity branch, so it +# does not help. The real fix is to disable the early-close path, so Grav never +# emits the bogus header and mod_deflate compresses cleanly (single header). +debugger: + shutdown: + close_connection: false +# Let the webserver own gzip; Grav does not compress or double-label. +cache: + gzip: false + allow_webserver_gzip: false