Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Brotli, Gzip correct order

Discussion in 'EasyApache' started by Zoltan Szabo, Mar 7, 2019.

Tags:
  1. Zoltan Szabo

    Zoltan Szabo Active Member

    Joined:
    Jul 13, 2017
    Messages:
    41
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Dear All,

    In a nutshell:
    How to set apache to favour Brotli over Gzip if both available!

    Story + Troubleshooting:
    Today I have enabled brotli via WHM => EasyApache => Apache modules => mod_brotli
    Online test show status okay: Brotli Test | Brotli compression check

    So far so good, but in chrome 72 dev tools I still see "content-encoding: gzip"
    The Chrome default request header is: "accept-encoding: gzip, deflate, br"

    I have changed the request header with a "ModHeader" named chrome extension.
    If its set to "br" it serves well with brotli if its gzip it server with "gzip".
    Here I tried to change the request header order to "accept-encoding: br, gzip"
    And its still GZIP <= Here is the problem

    I can clearly state that with the default apache Gzip (optimise website) and mod_brotli together prefers Gzip over Brotli which is a false logic, I want it on the other way!

    Can anyone help me how to configure apache to favour Brotli over Gzip if both available.
     
  2. Zoltan Szabo

    Zoltan Szabo Active Member

    Joined:
    Jul 13, 2017
    Messages:
    41
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Just to avoid any confusion here, my application doesn't pre compress any source. (None)
    So its not the case that Brotli avoides double compression coused by gzip pre compression.

    But I do beleive double compression avoidance could still be a problem. e.g. Gzil/deflate runs first then Brotli doesn't as it avoides double compression, so it just stays Gzip. (I might be wrong with this assumption - please correct me)

    Any idea how to solve this ?
     
  3. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,528
    Likes Received:
    2,180
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Zoltan Szabo,

    Can you open a support ticket so we can take a closer look at this issue? You can post the ticket number here and we'll link this thread to it.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Zoltan Szabo

    Zoltan Szabo Active Member

    Joined:
    Jul 13, 2017
    Messages:
    41
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Dear @cPanelMichael ,

    Before opening a support ticket I tried to troubleshoot it myself. I think I have a solution and also found a bug.

    I think the problem is with the inclusion order of the WHM brotli config file and the Cpanel optimise config file.
    See article here: Setting up Brotli Compression on your WebServer
    "Note that you need to specify the Brotli config first, or Apache will use gzip in preference to Brotli."

    Means Brotli needs to be first than Gzip/Deflate

    Temporaly solution:
    1. Keep mod_brotli installed (in WHM)
    2. Disable Optimise website (In Cpanel)
    3. Add Gzip / Deflate to each of the running websites .htaccess which is loaded long after Brotli init.

    This way it works very well, but this is still a kind of bug in Cpanel, by time you need to include Gzip or Brotli or both option in optimize website! Please upvote it here: Configure Brotli per-account

    I also discovered that webmanifest file zipping is somehow missing from default Gzip and also Brotli config file
    (application/manifest+json) MIME also needs to be added otherwise webmanifest not zipped!

    @cPanelMichael can you let me know where can I report this bug?

    Bye,
    Zoli
     
    #4 Zoltan Szabo, Mar 14, 2019
    Last edited: Mar 14, 2019
  5. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,528
    Likes Received:
    2,180
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @Zoltan Szabo,

    Our defect report form is available on the link below:

    cPanel Customer Portal

    Let me know the ticket number assigned to the report once it's opened and I'll update this thread with the outcome.

    Thank you.

    Update: Here's a quote from the support ticket explaining the outcome:

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    #5 cPanelMichael, Mar 15, 2019
    Last edited: May 1, 2019
  6. Zoltan Szabo

    Zoltan Szabo Active Member

    Joined:
    Jul 13, 2017
    Messages:
    41
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Hungary
    cPanel Access Level:
    Root Administrator
    Hello @cPanelMichael

    The Request ID is: 11678007

    Thank you,
     
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice