Open andypost opened 1 year ago
Apache 2 config additions from https://www.drupal.org/project/drupal/issues/3184242
+ # Serve brotli compressed CSS files if they exist and the client accepts brotli.
+ RewriteCond %{HTTP:Accept-encoding} br
+ RewriteCond %{REQUEST_FILENAME}\.br -s
+ RewriteRule ^(.*css_[a-zA-Z0-9-_]+)\.css$ $1\.css\.br [QSA]
...
+ # Serve brotli compressed JS files if they exist and the client accepts brotli.
+ RewriteCond %{HTTP:Accept-encoding} br
+ RewriteCond %{REQUEST_FILENAME}\.br -s
+ RewriteRule ^(.*js_[a-zA-Z0-9-_]+)\.js$ $1\.js\.br [QSA]
...
+ RewriteRule \.css\.br$ - [T=text/css,E=no-gzip:1,E=no-brotli:1]
+ RewriteRule \.js\.br$ - [T=text/javascript,E=no-gzip:1,E=no-brotli:1]
...
+ <FilesMatch "(\.js\.br\|\.css\.br)$">
+ # Serve correct encoding type.
+ Header set Content-Encoding br
+ # Force proxies to cache compressed & non-compressed css/js files separately.
+ Header append Vary Accept-Encoding
+ </FilesMatch>
We also should add static delivery for .well-known
also it needs to skip logging for images https://unit.nginx.org/news/2024/unit-1.32.0-released/#conditional-access-logging
Follow-up to https://github.com/skilld-labs/docker-php/pull/90
Probably it needs extra
match
rule to test url rewrite for.br
files for js/css assetsDocs https://unit.nginx.org/configuration/#static-files
Refs