• Resolved rjrjrjrj

    (@rjrjrjrj)


    I enabled compression under Browser Cache:

    Reduce server load and decrease response time by using the cache available in site visitor’s web browser.
    Browser Cache: Enable

    Enable HTTP compression and add headers to reduce server load and decrease file load time.

    But Lighthouse still recommends the following:

    Text-based resources should be served with compression (gzip, deflate or brotli) to minimize total network bytes. Learn more.FCPLCP
    WordPressYou can enable text compression in your web server configuration.
    URL
    	
    Transfer Size
    	
    Potential Savings
    …js/autoptimize_ca12a81….js(www.domain.sfx)	118.3 KiB	80.3 KiB
    …css/dashicons.min.css?ver=6.0.1(www.domain.sfx)	57.6 KiB	22.7 KiB
    …js/lazysizes.min.js?ao_version=3.1.0(www.domain.sfx)	9.6 KiB	5.6 KiB
    …js/lazyload.min.js(www.domain.sfx)	6.1 KiB	3.8 KiB

    Am I missing any settings for the above to be compressed?

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for reaching out.
    It’s very hard to troubleshoot the problem if I cannot access the website to inspect the problem.
    By default, the gzip compression should be enabled for all types in the Performance>Browser Cache (HTML&XML, JS&CSS, media, and other files)
    Check if the Gzip compression is enabled in Performance>Browser Cache>JS&CSS. if not, enable the setting, save all settings and purge the cache and see if the problem persists.
    Make sure that mod_deflate is enabled on your server if using apache, and check if you have any other manual rules in your .htaccess file that may be setting the gzip, and may conflict with the w3tc rules.

    I hope this helps!

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    It is like this:

    General: enabled
    JS&CSS: enabled
    HTML&XML: enabled
    Media and other files: enabled

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for your feedback.
    Can you please check if your .htaccess file has the following rules:

    <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>

    Also, Inspect the source of your website and in the Network tab, check the files that are listed by the lighthouse and see if there is a content-encoding: header.

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    <IfModule mod_deflate.c>
            AddOutputFilterByType DEFLATE text/css text/x-component application/x-javascript application/javascript text/javascript text/x-js text/html text/richtext text/plain text/xsd text/xsl text/xml image/bmp application/java application/msword application/vnd.ms-fontobject application/x-msdownload image/x-icon application/json application/vnd.ms-access video/webm application/vnd.ms-project application/x-font-otf application/vnd.ms-opentype application/vnd.oasis.opendocument.database application/vnd.oasis.opendocument.chart application/vnd.oasis.opendocument.formula application/vnd.oasis.opendocument.graphics application/vnd.oasis.opendocument.presentation application/vnd.oasis.opendocument.spreadsheet application/vnd.oasis.opendocument.text audio/ogg application/pdf application/vnd.ms-powerpoint image/svg+xml application/x-shockwave-flash image/tiff application/x-font-ttf application/vnd.ms-opentype audio/wav application/vnd.ms-write application/font-woff application/font-woff2 application/vnd.ms-excel
        <IfModule mod_mime.c>
            # DEFLATE by extension
            AddOutputFilter DEFLATE js css htm html xml
        </IfModule>
    </IfModule>
    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    Request header:

    Accept	*/*
    Accept-Encoding	gzip, deflate, br
    Accept-Language	en-US,en;q=0.5
    Cache-Control	no-cache
    Connection	keep-alive
    Cookie	pll_language=en; ...
    Host	www.domain.sfx
    Pragma	no-cache
    Referer	https://www.domain.sfx/
    Sec-Fetch-Dest	script
    Sec-Fetch-Mode	no-cors
    Sec-Fetch-Site	same-origin
    TE	trailers
    User-Agent	Mozilla/5.0 ...

    Response header:

    accept-ranges	bytes
    cache-control	public, immutable, public
    content-length	168983
    content-security-policy	upgrade-insecure-requests
    content-type	application/x-javascript
    date	Tue, 09 Aug 2022 18:37:01 GMT
    etag	"29417-...."
    last-modified	Thu, 04 Aug 2022 00:54:10 GMT
    permissions-policy	
    pragma	public
    referrer-policy	strict-origin-when-cross-origin
    referrer-policy	no-referrer-when-downgrade
    server	Apache
    strict-transport-security	max-age=31536000
    vary	Accept-Encoding
    x-content-type-options	nosniff
    X-Firefox-Spdy	h2
    x-frame-options	SAMEORIGIN
    x-xss-protection	0
    x-xss-protection	1; mode=block
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    So the .htaccess part looks as it should. I am not seeing the content-encoding: header which means that the gzip indeed is not working for those files

    In this case, please check for any other .htaccess files in the upper level of your website’s structure or some server rules that are adding or removing gzip intentionally.
    Check if zlib_compression is enabled on a server lave as this also may cause conflict.
    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    That was the upper level of the web site. There are no more .htaccess files.

    From my phpinfo():

    Registered PHP Streams	php, file, glob, data, http, ftp, zip, compress.zlib, compress.bzip2, https, ftps, phar
    Registered Stream Filters	convert.iconv.*, string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, dechunk, zlib.*, bzip2.*
    ZLib Version 	1.2.12 
    zlib
    ZLib Support	enabled
    Stream Wrapper 	compress.zlib://
    Stream Filter 	zlib.inflate, zlib.deflate
    Compiled Version 	1.2.12
    Linked Version 	1.2.12
    Directive	Local Value	Master Value
    zlib.output_compression	Off	Off
    zlib.output_compression_level	-1	-1
    zlib.output_handler	no value	no value
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for your feedback.

    As I’ve mentioned before, the .htaccess rules look as they should. So everything is set up as it should in W3 Total Cache, however, it appears that something is not allowing the gzip.
    This is a very simple method. For apache servers, mod_deflate needs to be installed. The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.
    W3TC adds the rules to .htaccess file which ensures that gzip is enabled for all files selected in the W3 Total Cache BC settings.
    mod_deflate should be installed on most servers by default. If the mod_deflate is installed, and the rules are added to the .htaccess file, this should work unless some server rules are added, possibly to httpd.conf that are not allowing compression.

    Again without checking the website and having more information about the server and the server configuration I cannot be sure what may be causing this.

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    deflate looks enabled to me:

    HTTP_ACCEPT_ENCODING 	gzip, deflate, br 
    Accept-Encoding 	gzip, deflate, br 
    Stream Filter 	zlib.inflate, zlib.deflate 
    $_SERVER['HTTP_ACCEPT_ENCODING']	gzip, deflate, br
    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    It appears so, and it seems that some server configuration is preventing this.
    You should check with your hosting provider and check the httpd.conf
    and also try with the default .htaccess

    Thanks!

    Thread Starter rjrjrjrj

    (@rjrjrjrj)

    Turns out that the above phpinfo() was misleading.
    deflate_module was in fact disabled. Now that it is enabled it is all hunky dory.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @rjrjrjrj

    Thank you for your feedback.
    I am glad you found the source of the problem and I am glad to know everything is working as expected now.
    Thanks!

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Lighthouse recommends compression even when enabled’ is closed to new replies.