feat: offer brotli for the assets the webhost now serves itself
This commit is contained in:
1 parent
e96dd0f06d
commit
322a59b31c
1 file changed
+52
@@ -75,6 +75,58 @@ AddType image/webp .webp
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
# Brotli, where the host has the module. It beats gzip by roughly 15-20% on the theme's
|
||||
# minified css/js at no measurable cost, and falls back to the mod_deflate block above for
|
||||
# clients that do not announce `br` - which is also what happens wholesale if the module is
|
||||
# missing, because the whole block is then skipped.
|
||||
#
|
||||
# The type list is deliberately the same one mod_deflate gets: `no-gzip` below switches gzip
|
||||
# off for every br-capable client, so a type listed for DEFLATE only would reach those
|
||||
# clients uncompressed.
|
||||
<IfModule mod_brotli.c>
|
||||
# Both filters would otherwise run for a client announcing `br, gzip` and gzip the brotli
|
||||
# output on top of itself. mod_deflate honours `no-gzip`, so brotli wins where it is
|
||||
# offered and gzip keeps everyone else.
|
||||
<IfModule mod_setenvif.c>
|
||||
SetEnvIfNoCase Accept-Encoding "(^|[\s,])br($|[\s,;])" no-gzip
|
||||
</IfModule>
|
||||
|
||||
<IfModule mod_filter.c>
|
||||
AddOutputFilterByType BROTLI_COMPRESS application/atom+xml \
|
||||
application/javascript \
|
||||
application/json \
|
||||
application/ld+json \
|
||||
application/manifest+json \
|
||||
application/rdf+xml \
|
||||
application/rss+xml \
|
||||
application/schema+json \
|
||||
application/vnd.geo+json \
|
||||
application/vnd.ms-fontobject \
|
||||
application/x-font-ttf \
|
||||
application/x-javascript \
|
||||
application/x-web-app-manifest+json \
|
||||
application/xhtml+xml \
|
||||
application/xml \
|
||||
font/eot \
|
||||
font/opentype \
|
||||
image/bmp \
|
||||
image/svg+xml \
|
||||
image/vnd.microsoft.icon \
|
||||
image/x-icon \
|
||||
text/cache-manifest \
|
||||
text/css \
|
||||
text/html \
|
||||
text/javascript \
|
||||
text/plain \
|
||||
text/vcard \
|
||||
text/vnd.rim.location.xloc \
|
||||
text/vtt \
|
||||
text/x-component \
|
||||
text/x-cross-domain-policy \
|
||||
text/xml
|
||||
</IfModule>
|
||||
</IfModule>
|
||||
|
||||
### End: Compression ###
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user