Bug 36531: Serve text/javascript compressed, like application/javascript is

Koha serves static .js files as application/javascript (if /etc/mime.types
says to) and serves them compressed, but output_with_http_headers uses the
currently-correct text/javascript mimetype, and Koha doesn't compress that.

Test plan:
1. Set the preference EnableAdvancedCatalogingEditor to Enable.
2. Open the browser Web Developer Tools to the Network tab
3. Load Cataloging - Advanced editor
4. Click on the line for the framework?frameworkcode=&callback=define load
5. Note the content-type text/javascript, no Content-Encoding line, and
   the size of 1.9MB
6. Apply the patches from bug 36463 if they haven't been pushed, then this
   patch, and reset_all
7. Repeat steps 1-4, and note a Content-Encoding: gzip header and a
   Transferred size around 160KB

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit c52af2cef0)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
(cherry picked from commit 3e0c3032b6)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Phil Ringnalda 2024-04-04 18:59:34 -07:00 committed by Lucas Gass
parent 1a8ed12e09
commit b9d4408648
2 changed files with 5 additions and 3 deletions

View file

@ -37,7 +37,7 @@ SetEnv PERL5LIB "/usr/share/koha/lib"
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/javascript text/javascript application/x-javascript application/json
DeflateCompressionLevel 9

View file

@ -50,6 +50,7 @@
mod_gzip_item_exclude rspheader Content-Type:image/*
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^text/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include file \.php$
mod_gzip_item_include mime ^text/html$
@ -62,7 +63,7 @@
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/javascript text/javascript application/x-javascript application/json
DeflateCompressionLevel 9
@ -188,6 +189,7 @@
mod_gzip_item_exclude rspheader Content-Type:image/*
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^text/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include file \.php$
mod_gzip_item_include mime ^text/html$
@ -200,7 +202,7 @@
# Compress content with type html, text, and css, ...
AddOutputFilterByType DEFLATE text/plain text/html text/xml text/css
AddOutputFilterByType DEFLATE application/xml application/xhtml+xml application/rss+xml
AddOutputFilterByType DEFLATE application/javascript application/x-javascript application/json
AddOutputFilterByType DEFLATE application/javascript text/javascript application/x-javascript application/json
DeflateCompressionLevel 9