Problem/Motivation
The .htaccess files generated during cron through \Drupal\advagg\Asset::generateHtaccess
are missing the "E=no-brotli:1" flag, resulting in serving double Brotli-compressed assets.
The content-type header for gzipped assets has also been statically set to "application/javascript" when it should interpolate the function-scoped $type
variable.
Originally, I was experiencing what I believed were corrupt assets as noted in the Compression Option's "Gzip" settings toggles, which reads "This should be enabled unless you are experiencing corrupted compressed asset files." This was due to the double-compression of assets, and resulted in the compressed files being served in plain text.
This may be a fix for that issue, as well.
Steps to reproduce
Enable Advanced Aggregation and run its related cron job. Check the resulting .htaccess files located at public://js/optimized/.htaccess
and public://css/optimized/.htaccess
.
Proposed resolution
Replace RewriteRule \.{$extension}\.br$ - [T={$type},E=no-gzip:1]
with RewriteRule \.{$extension}\.br$ - [T={$type},E=no-gzip:1,E=no-brotli:1]
.
Replace RewriteRule \.{$extension}\.gz$ - [T=application/javascript,E=no-gzip:1]
with RewriteRule \.{$extension}\.gz$ - [T={$type},E=no-gzip:1,E=no-brotli:1]
.
Remaining tasks
Replace relevant .htaccess directives.
User interface changes
API changes
Data model changes