mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-09-04 20:24:12 +08:00
Improve Apache gzip & brotli handling
This commit is contained in:
parent
6896f080e8
commit
1f9e96f107
2 changed files with 46 additions and 42 deletions
29
.htaccess
29
.htaccess
|
@ -32,35 +32,6 @@
|
||||||
|
|
||||||
# Google FLoC
|
# Google FLoC
|
||||||
# Header set Permissions-Policy "interest-cohort=()"
|
# Header set Permissions-Policy "interest-cohort=()"
|
||||||
|
|
||||||
<FilesMatch "(\.js\.br|\.css\.br)$">
|
|
||||||
SetEnv no-gzip 1
|
|
||||||
SetEnv no-brotli 1
|
|
||||||
# Serve correct encoding type.
|
|
||||||
Header append Content-Encoding br
|
|
||||||
# Force proxies to cache brotli &
|
|
||||||
# non-brotli css/js files separately.
|
|
||||||
Header append Vary Accept-Encoding
|
|
||||||
</FilesMatch>
|
|
||||||
|
|
||||||
<FilesMatch "(\.js\.gz|\.css\.gz)$">
|
|
||||||
SetEnv no-gzip 1
|
|
||||||
SetEnv no-brotli 1
|
|
||||||
# Serve correct encoding type.
|
|
||||||
Header append Content-Encoding gzip
|
|
||||||
# Force proxies to cache gzipped &
|
|
||||||
# non-gzipped css/js files separately.
|
|
||||||
Header append Vary Accept-Encoding
|
|
||||||
</FilesMatch>
|
|
||||||
|
|
||||||
<FilesMatch "(\.js\.br|\.js\.gz)$">
|
|
||||||
Header set Content-Type "application/javascript; charset=utf-8"
|
|
||||||
ForceType application/javascript
|
|
||||||
</FilesMatch>
|
|
||||||
<FilesMatch "(\.css\.br|\.css\.gz)$">
|
|
||||||
Header set Content-Type "text/css; charset=utf-8"
|
|
||||||
ForceType text/css
|
|
||||||
</FilesMatch>
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
#<IfModule mod_brotli.c>
|
#<IfModule mod_brotli.c>
|
||||||
|
|
|
@ -1,17 +1,50 @@
|
||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_headers.c>
|
||||||
RewriteCond %{HTTP:Accept-encoding} br
|
<IfModule mod_rewrite.c>
|
||||||
RewriteCond "%{REQUEST_FILENAME}\.br" -s
|
RewriteEngine On
|
||||||
RewriteRule "^(.+\.js)$" "$1\.br" [L,T=application/javascript,QSA]
|
|
||||||
|
|
||||||
RewriteCond %{HTTP:Accept-encoding} gzip
|
RewriteCond %{HTTP:Accept-encoding} br
|
||||||
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
|
RewriteCond "%{REQUEST_FILENAME}\.br" -s
|
||||||
RewriteRule "^(.+\.js)$" "$1\.gz" [L,T=application/javascript,QSA]
|
RewriteRule "^(.+\.js)$" "$1\.br" [L,T=application/javascript,QSA]
|
||||||
|
|
||||||
RewriteCond %{HTTP:Accept-encoding} br
|
RewriteCond %{HTTP:Accept-encoding} gzip
|
||||||
RewriteCond "%{REQUEST_FILENAME}\.br" -s
|
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
|
||||||
RewriteRule "^(.+\.css)$" "$1\.br" [L,T=text/css,QSA]
|
RewriteRule "^(.+\.js)$" "$1\.gz" [L,T=application/javascript,QSA]
|
||||||
|
|
||||||
RewriteCond %{HTTP:Accept-encoding} gzip
|
RewriteCond %{HTTP:Accept-encoding} br
|
||||||
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
|
RewriteCond "%{REQUEST_FILENAME}\.br" -s
|
||||||
RewriteRule "^(.+\.css)$" "$1\.gz" [L,T=text/css,QSA]
|
RewriteRule "^(.+\.css)$" "$1\.br" [L,T=text/css,QSA]
|
||||||
|
|
||||||
|
RewriteCond %{HTTP:Accept-encoding} gzip
|
||||||
|
RewriteCond "%{REQUEST_FILENAME}\.gz" -s
|
||||||
|
RewriteRule "^(.+\.css)$" "$1\.gz" [L,T=text/css,QSA]
|
||||||
|
|
||||||
|
<FilesMatch "(\.js\.br|\.css\.br)$">
|
||||||
|
SetEnv no-gzip 1
|
||||||
|
SetEnv no-brotli 1
|
||||||
|
# Serve correct encoding type.
|
||||||
|
Header append Content-Encoding br
|
||||||
|
# Force proxies to cache brotli &
|
||||||
|
# non-brotli css/js files separately.
|
||||||
|
Header append Vary Accept-Encoding
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "(\.js\.gz|\.css\.gz)$">
|
||||||
|
SetEnv no-gzip 1
|
||||||
|
SetEnv no-brotli 1
|
||||||
|
# Serve correct encoding type.
|
||||||
|
Header append Content-Encoding gzip
|
||||||
|
# Force proxies to cache gzipped &
|
||||||
|
# non-gzipped css/js files separately.
|
||||||
|
Header append Vary Accept-Encoding
|
||||||
|
</FilesMatch>
|
||||||
|
|
||||||
|
<FilesMatch "(\.js\.br|\.js\.gz)$">
|
||||||
|
Header set Content-Type "application/javascript; charset=utf-8"
|
||||||
|
ForceType application/javascript
|
||||||
|
</FilesMatch>
|
||||||
|
<FilesMatch "(\.css\.br|\.css\.gz)$">
|
||||||
|
Header set Content-Type "text/css; charset=utf-8"
|
||||||
|
ForceType text/css
|
||||||
|
</FilesMatch>
|
||||||
|
</IfModule>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
Loading…
Add table
Reference in a new issue