Improve handling of gzipped built html/web applications

In I5e5d2da0ef3c385f836507e69a686821aba925a1 we applied new
rewrite rules and mimetypes on logs-dev.o.o to try and make
sure that rich html content (css/js/fonts) would work either
when gzipped prior to initial log upload or when automatically
gzipped after some time.

This brings the change from logs-dev.o.o to logs.o.o.

Change-Id: I20db0aa12eda8157d68a7b27dbbfe3ca729347c7
This commit is contained in:
David Moreau-Simard 2016-11-15 09:31:39 -05:00
parent 48fd0cc79a
commit 9345873ac2

View File

@ -21,13 +21,27 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
# use Apache to compress the results afterwards, to save on the wire
# it's approx 18x savings of wire traffic to compress. We need to
# compress by content types that htmlify can produce
AddOutputFilterByType DEFLATE text/plain text/html
AddOutputFilterByType DEFLATE text/plain text/html application/x-font-ttf
<FilesMatch \.html\.gz$>
ForceType text/html
AddDefaultCharset UTF-8
AddEncoding x-gzip gz
</FilesMatch>
<FilesMatch \.css\.gz$>
ForceType text/css
AddDefaultCharset UTF-8
AddEncoding x-gzip gz
</FilesMatch>
<FilesMatch \.js\.gz$>
ForceType text/javascript
AddDefaultCharset UTF-8
AddEncoding x-gzip gz
</FilesMatch>
<FilesMatch \.ttf\.gz$>
ForceType application/x-font-ttf
AddEncoding x-gzip gz
</FilesMatch>
<FilesMatch \.css$>
# mod_mime_magic is sometimes passing css files as asm sources
# e.g css files generated by coverage reports
@ -63,6 +77,12 @@ NameVirtualHost <%= @vhost_name %>:<%= @port %>
</Directory>
RewriteEngine On
# If the specified file does not exist, look if there is a gzipped version
# If there is, serve that one instead
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME}.gz -f
RewriteRule ^/(.*)$ %{REQUEST_URI}.gz
# rewrite txt.gz & console.html[.gz] files to map to our internal htmlify
# wsgi app
# PT, Pass-through: to come back around and get picked up by the