So my question to the list is this: Can I, with a reasonable level of 
convenience, install and use both to get the best of both worlds? Is there any 
advantage to doing so or does the hassle of managing 2 types of compression (my 
intention would be to pre-compress what content I can to minimize the ongoing 
CPU hit) negate any bandwidth savings I may realize with this strategy? If 
using both is reasonable (and possible) how does the server determine which to 
serve on an asset by asset basis? Can it be done dynamically based upon best 
compression result for the individual asset or do the directives have the be 
pre-written to favour one over the other based upon the nature of my content? 
Yes, you can install both modules. This is how i would setup (JUST AN EXAMPLE!):

[SNIP]
<IfModule brotli_module>
# Compression
## BrotliCompressionQuality: 0-11 (default: 11)
BrotliCompressionQuality 8

## BrotliCompressionWindow: 10-24 (default: 22)
BrotliCompressionWindow 18

# Logging
# Filter note
BrotliFilterNote Input brotli_in
BrotliFilterNote Output brotli_out
BrotliFilterNote Ratio brotli_ratio

# Output filter
AddOutputFilterByType BROTLI_COMPRESS text/html text/plain text/css text/xml
AddOutputFilterByType BROTLI_COMPRESS text/css
AddOutputFilterByType BROTLI_COMPRESS application/x-javascript 
application/javascript
AddOutputFilterByType BROTLI_COMPRESS application/rss+xml
AddOutputFilterByType BROTLI_COMPRESS application/json
# This is compressed by deflate, check deflate_module configuration block below
# AddOutputFilterByType BROTLI_COMPRESS application/xml

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

# Global output filer if necessary.
# SetOutputFilter BROTLI_COMPRESS
# SetEnvIfNoCase Request_URI .txt$ no-br
</IfModule>

# If brotli is not installed use deflate
# <IfModule !brotli_module>
# <IfModule deflate_module>
# AddOutputFilterByType DEFLATE text/html text/plain text/xml
# AddOutputFilterByType DEFLATE text/css
# #AddOutputFilterByType DEFLATE image/jpeg image/png
# AddOutputFilterByType DEFLATE application/x-javascript application/javascript 
application/ecmascript
# AddOutputFilterByType DEFLATE application/rss+xml
# AddOutputFilterByType DEFLATE application/xml
# </IfModule>
# </IfModule>

<IfModule deflate_module>
 # here we compress application/xml using deflate instead of brotli
 AddOutputFilterByType DEFLATE application/xml
</IfModule>
[/SNIP]

Ciao, Dino.

Reply via email to