diff --git a/public/.htaccess b/public/.htaccess index 3646650..886dacf 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -57,6 +57,29 @@ DirectoryIndex index.php # Rewrite all other queries to the front controller. RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ %{ENV:BASE}/index.php [L] + + # Brotli + # If the web browser accept brotli encoding ... + RewriteCond %{HTTP:Accept-encoding} br + # ... and the web browser is fetching a probably pre-compressed file ... + RewriteCond %{REQUEST_URI} .*\.(pck|wasm)$ + # ... and a matching pre-compressed file exists ... + RewriteCond %{REQUEST_FILENAME}\.br -s + # ... then rewrite the request to deliver the brotli file + RewriteRule ^(.*) $1.br + # For each file format set the correct mime type (otherwise brotli mime type is returned) and prevent Apache for recompressing the files + RewriteRule "\.pck\.br$" "-" [T=application/octet-stream,E=no-brotli,E=no-gzip] + RewriteRule "\.wasm\.br$" "-" [T=application/wasm,E=no-brotli,E=no-gzip] + + + # Prevent mime module to set brazilian language header (because the file ends with .br) + RemoveLanguage .br + # Set the correct encoding type + Header set Content-Encoding br + # Force proxies to cache brotli & non-brotli files separately + Header append Vary Accept-Encoding + +