Skip to content

Commit 007b168

Browse files
committed
don’t do internal gzip, rely on webserver
Signed-off-by: Andy Miller <rhuk@mac.com>
1 parent 952830b commit 007b168

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

system/src/Grav/Common/Grav.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,10 @@ public function shutdown(): void
608608
// Unfortunately without FastCGI there is no way to force close the connection.
609609
// We need to ask browser to close the connection for us.
610610

611-
// With zlib.output_compression enabled, PHP handles compression automatically.
612-
// We cannot set Content-Length when compression is active (size unknown until compressed).
613-
if (!$config->get('system.cache.gzip') && !ini_get('zlib.output_compression')) {
614-
if ($config->get('system.cache.allow_webserver_gzip')) {
615-
// Let web server to do the hard work.
611+
// Check if external compression is active (e.g., zlib.output_compression in php.ini).
612+
if (!ini_get('zlib.output_compression')) {
613+
if ($config->get('system.cache.gzip') || $config->get('system.cache.allow_webserver_gzip')) {
614+
// Let web server handle compression.
616615
header('Content-Encoding: identity');
617616
} elseif (function_exists('apache_setenv')) {
618617
// Without gzip we have no other choice than to prevent server from compressing the output.

system/src/Grav/Common/Processors/InitializeProcessor.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,12 +345,6 @@ protected function initializeOutputBuffering(Config $config): void
345345

346346
// Use output buffering to prevent headers from being sent too early.
347347
ob_start();
348-
if ($config->get('system.cache.gzip')) {
349-
// Try to use zlib.output_compression instead of ob_gzhandler (more robust)
350-
if (!ini_get('zlib.output_compression') && !headers_sent()) {
351-
ini_set('zlib.output_compression', '4096');
352-
}
353-
}
354348

355349
$this->stopTimer('_init_ob');
356350
}

0 commit comments

Comments
 (0)