Cron-generated .htaccess files invalid, breaking full-site rendering

Created on 17 October 2023, over 1 year ago

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.

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}\.gz$ - [T=application/javascript,E=no-gzip:1]` with `RewriteRule \.{$extension}\.gz$ - [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

πŸ› Bug report
Status

Active

Version

6.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States FrankieD3

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024