Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
On Apache, we need to prevent double-compression by mod_brotli (in addition to mod_deflate). See https://httpd.apache.org/docs/2.4/mod/mod_brotli.html
If mod_brotli is enabled and active for text/css and text/javascript, a Drupal site's precompressed CSS and JS cannot be loaded by the browser (Failed to load resource: net::ERR_CONTENT_DECODING_FAILED) so I'm classifying this as a bug rather than feature request.
Comment | File | Size | Author |
---|---|---|---|
#2 | 3023545-mod_brotli.patch | 742 bytes | mfb |
Comments
Comment #2
mfbComment #3
Ayesh CreditAttribution: Ayesh commentedI had Brotli enabled all my servers but never ran into this problem because I was compressing everything on the fly and didn't use pre-compressed gzip files (additional disk access didn't outweigh compression overhead).
To provide more information to others, this problem occurs only if you serve pre-compressed Brotli or Gzip files with a rewrite rule. Enabling Brotli with a filter (for example with
AddOutputFilterByType BROTLI_COMPRESS application/json
) does not double-encode the response.If you serve .gz files with a rewrite rule, the patch fixes it. I call we can mark this RTBC if a few others can confirm.
Comment #4
d13r CreditAttribution: d13r commentedThe patch worked for me - thanks.
Comment #5
andypostBtw advagg allows it, so better to add support for it to core
Comment #6
AnybodyPatch from #2 works perfectly and solved it equally to Drupal 8. We should get this in as long as Drupal 7 is still maintained. Thank you all!
Here you can find the committed Drupal 8 patch / issue: #2960808: Disable brotli compression of pre-compressed CSS and JS
Comment #7
mcdruidLGTM.
Would be good to combine this in the same release as any other .htaccess changes we're working on (e.g. #2768921: Backport server configuration code from SA-CORE-2016-003 to Drupal 7)
Comment #8
Fabianx CreditAttribution: Fabianx as a volunteer and at Tag1 Consulting commentedRTBC + 1
Comment #10
mcdruidThankingyou!