• Resolved rohilv

    (@rohilxm)


    Hi,

    I am trying to use Brotli compression on my website for certain content types and others to have gzip compression, but the checkbox to select Brotli compression is disabled in Browser cache options.
    I have enabled Brotli module in my Apache Server’s configuration and also used KeyCDN’s tool to verify Brotli support (https://tools.keycdn.com/brotli-test) which say that server supports it. (Attaching reference screenshots)
    What method does W3TC uses to determine Brotli support ?

    Ref Screenshots:
    https://pasteboard.co/HZL4681.png
    https://pasteboard.co/HZL4Bb8.png

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter rohilv

    (@rohilxm)

    I tried disabling gzip compression from Browser Cache setting of W3TC and added Brotli related code manually in .htaccess and successfully got content-type: br in script headers (Ref: https://pasteboard.co/HZRqTlp.png). And also the PageSpeed score jumped from 30 to 60 for mobile devices.
    But I want to use gzip as fallback for unsupported browsers. Also the point remains that W3TC still doesn’t detect that server supports Brotli compression. Is this some bug in the plugin?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    We check if php support for brotli compression is available. We don’t allow to use brotli for html when there’s no PHP functionality.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Please install this module so you can enable brotli. Link below:
    https://github.com/kjdev/php-ext-brotli

    Thread Starter rohilv

    (@rohilxm)

    Thanks.
    I will try installing the above module and leave feedback here.

    Thread Starter rohilv

    (@rohilxm)

    I installed the module and it enabled the option to select Brotli compression.
    I selected it and saved setting with purge cache.
    It threw 500 error for the whole website.

    On checking logs it says “Unknown filter provider BROTLI_COMPRESS”

    • This reply was modified 6 years, 1 month ago by rohilv.
    Thread Starter rohilv

    (@rohilxm)

    with reference to this : https://github.com/kjdev/apache-mod-brotli

    I changed BROTLI_COMPRESS to BROTLI and it worked. But everytime I save cache settings or purge cache the .htaccess values are reverted to BROTLI_COMPRESS and the website throws 500 error.

    Tried deleting whole block of Brotli code that W3TC inserts in .htaccess, the browser cache setting page is loaded, then tried unticking Brotli compression option and saving the setting. But it re-writes the Brotli block in .htaccess again with BROTLI_COMPRESS

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    Thank you for the update. We will replicate the issue and fix this as soon as possible.
    Thanks once again.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello,
    We’ve added this to our list of issues. This will be fixed in future releases.
    Thank you for your patience.

    Plugin Contributor gidomanders

    (@gidomanders)

    Hi @rohilxm,

    I looked into the reason we use AddOutputFilterByType BROTLI_COMPRESS and AddOutputFilter BROTLI_COMPRESS. The reason we do that, is because the Apache website suggests it:
    https://httpd.apache.org/docs/trunk/mod/mod_brotli.html

    You are probably using another mod that requires BROTLI instead. You could switch mods or disable the brotli option in the browser cache settings and add the code for brotli to your .htaccess file outside of the W3TC blocks.

    We check for the PHP function brotli_compress, because that function is used to compress cache files and store a compressed version of the cache, same as we do for gzip compression. If we would not do this, the server has to dynamically compress files when requested, which takes some time. That would defeat the purpose of using compression to speed up the website.

    If you want to use the Apache module only, which I do not recommend, you could always add the required code manually to your .htaccess file outside of the W3TC blocks.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Brotli not enabled even though server supports it’ is closed to new replies.