Page MenuHomePhabricator

gzip compression not working with mod_deflate
Open, Needs TriagePublic

Description

I have
MediaWiki 1.35.1
PHP 7.3.27-1~deb10u1 (apache2handler)
MariaDB 10.3.27-MariaDB-0+deb10u1
ICU 63.1
LuaSandbox 3.0.3
Lua 5.1.5
Installed on debian buster.

I use apache2 with mod_deflate on all my virtualhosts to enable gzip compression. On all other sotware I have no issues.
If I test gzip compression with https://www.giftofspeed.com/gzip-test/ on my wiki the test is not passed.
If I comment line 1073 in includes/MediaWiki.php

apache_setenv( 'no-gzip', '1' )

the test is pass

These are the headers before and after the edit (no changes I noticed)

curl -X HEAD -i https://mywiki
HTTP/1.1 200 OK
Date: Wed, 24 Mar 2021 09:18:24 GMT
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Content-language: it
Vary: Accept-Encoding,Cookie
Expires: Wed, 24 Mar 2021 09:18:24 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-Modified: Wed, 24 Mar 2021 08:53:07 GMT
Connection: close
Content-Encoding: identity
Content-Length: 25255
X-Request-Id: id
Content-Type: text/html; charset=UTF-8

curl: (18) transfer closed with 25255 bytes remaining to read
curl -X HEAD -i https://mywiki
Warning: Setting custom HTTP method to HEAD with -X/--request may not work the 
Warning: way you want. Consider using -I/--head instead.
HTTP/1.1 200 OK
Date: Wed, 24 Mar 2021 09:19:54 GMT
Server: Apache
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
X-Content-Type-Options: nosniff
Content-language: it
Vary: Accept-Encoding,Cookie
Expires: Wed, 24 Mar 2021 09:19:54 GMT
Cache-Control: private, must-revalidate, max-age=0
Last-Modified: Wed, 24 Mar 2021 08:53:07 GMT
Connection: close
Content-Encoding: identity
Content-Length: 25255
X-Request-Id: id
Content-Type: text/html; charset=UTF-8

I am sure there are some other important information I missed, I am sorry for this.

Event Timeline

This reminds me of $wgDisableOutputCompression and compression issues mentioned in T235554. No idea if related though.

I read it and I wasn't sure it is related. The line code involved are the same but the problem is the opposite.
If I change $wgDisableOutputCompression to false I don't notice a change (but it's obvious in effect false is the default value).