don’t do internal gzip, rely on webserver

Signed-off-by: Andy Miller <rhuk@mac.com>
This commit is contained in:
Andy Miller
2025-12-25 21:41:20 -07:00
parent 952830b529
commit 007b168ad9
2 changed files with 4 additions and 11 deletions

View File

@@ -608,11 +608,10 @@ class Grav extends Container
// Unfortunately without FastCGI there is no way to force close the connection.
// We need to ask browser to close the connection for us.
// With zlib.output_compression enabled, PHP handles compression automatically.
// We cannot set Content-Length when compression is active (size unknown until compressed).
if (!$config->get('system.cache.gzip') && !ini_get('zlib.output_compression')) {
if ($config->get('system.cache.allow_webserver_gzip')) {
// Let web server to do the hard work.
// Check if external compression is active (e.g., zlib.output_compression in php.ini).
if (!ini_get('zlib.output_compression')) {
if ($config->get('system.cache.gzip') || $config->get('system.cache.allow_webserver_gzip')) {
// Let web server handle compression.
header('Content-Encoding: identity');
} elseif (function_exists('apache_setenv')) {
// Without gzip we have no other choice than to prevent server from compressing the output.

View File

@@ -345,12 +345,6 @@ class InitializeProcessor extends ProcessorBase
// Use output buffering to prevent headers from being sent too early.
ob_start();
if ($config->get('system.cache.gzip')) {
// Try to use zlib.output_compression instead of ob_gzhandler (more robust)
if (!ini_get('zlib.output_compression') && !headers_sent()) {
ini_set('zlib.output_compression', '4096');
}
}
$this->stopTimer('_init_ob');
}