GZIP/Brotli Compression not working as intended via Server Configuration > Tuning

#1
Enabling/disabling both Dynamic and Static compression for gzip and brotli in the server config tab does nothing. Compression is always ON regardless of setting.
When trying to change the level of compression in all fields, data size of compressed files stays the same according to GTmetrix and Chrome Network Console tab even after complete cache purge (Empty Entire Cache in LSCache plugin). Once the data setting changed to reflect the desired compression level but later was not able to replicate how that was achieved including server restart and OLS graceful restart.

The only way I managed to disable all compression was when I started deleting Compressible Types (MIME types) field. This is not an ideal solution, however as I just want to disable the static brotli compression and adjust the dynamic and static gzip compressions to play nice with my CPU and MEM as my CDN does not accept brotli.

Setting rewrite rules and SetEnv via .htaccess to disable brotli or gzip has no effect as well.
Rewrite rule I used: RewriteRule . - [E=no-gzip:1] RewriteRule . - [E=no-brotli:1]
SetEnv I used: SetEnv no-gzip 1 SetEnv no-brotli 1

Another problem I also noticed is that the Min Static File Size (bytes) is not applied correctly. I have it set to 1280 bytes (everything under that fits in 1 packet so no need for compression) but the server ignores it and compresses files under the specified number.

I use OLS deployment in GCloud instance.
OLS version: 1.6.18 Stable
PHP 7.4.14
WP 5.6 with LSCache 3.6.1
Enable Compression set to Yes in Virtual Host (disabling on server level should override the VHost)
zlib.output_compression = Off in php.ini (as it should be)
CDN is disabled while testing compression settings

Please let me know if I can add additional info so you can better reproduce the issue!
Regards!
 
#3
Do you still see the compression if you disable the LSCache plugin and compression at the OLS server level?
(Server level) Enable Compression No; (LSCache) Enable Cache Off

Upon disabling the LSCache plugin the Compression setting seems to work for Dynamic gzip (html) files.
However the rest of the page is still served with brotli or gzip compression (css, js, text etc.)

The "Min Static File Size" seems to be respected only for brotli, meaning if a file is below the size threshold I specified it is still being compressed but with gzip instead of brotli.

Changing the static compression level for both gzip and brotli again does nothing when the LSCache is Off with server compression both On and Off.

Trying to stop brotli and gzip via Rewrite Rule or SetEnv still does not work. (maybe it's my wrong doing so would appreciate a different implementation suggestion)

Please let me know if I can provide more info!
Regards!
 
Last edited:

Cold-Egg

Administrator
#4
I launched a fresh wordpress, no such issue still(I mean turning off the compression works). Have you checked the static files from the incognito browser? Any CDN/proxy in the front? Possible to share the site URL so we can take a look?
 
#5
I launched a fresh wordpress, no such issue still(I mean turning off the compression works). Have you checked the static files from the incognito browser? Any CDN/proxy in the front? Possible to share the site URL so we can take a look?
Yes I check the files using the Chrome and Edge Network tab in the console with Cache disabled and enabled and also hard refresh with Ctrl+Shift+R
I deployed the instance a while back and switched from lsphp 7.3 to 7.4 in the meantime but that should not affect how the server zips files IMO.
No CDN/proxy used at the moment. It is my test deployment which is live so you can check it out and if needed I can show some server config or anything that might help.

Will send you PM with the link.

Regards!
 
Top