Bug 22262

Summary: text/javascript responses should be compressed by Apache
Product: Koha Reporter: Galen Charlton <gmcharlt>
Component: Web servicesAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: dcook, josef.moravec
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Galen Charlton 2019-02-01 19:23:05 UTC
Neither the vanilla Apache configuration nor the Debian one includes text/javascript in the list of MIME types of responses that get compressed by mod_deflate. Since some APIs under /svc/ happen to use that MIME type in their responses, a bit of bandwidth can be unnecessarily wasted.

However, the lack of compression is of more import for svc/cataloguing/framework, which transfers a megabyte or so whenever it is invoked to fetch the default MARC21 framework (and presumably a similar amount of data for other MARC frameworks). Since that API is invoked when Rancor initializes, it's been observed that over a slow connection a RequireJS "define" call can time out, leading to the MARC editor never fully initializing and an error like this appearing in the browser debug console:

"error" load timeout for modules: /cgi-bin/koha/svc/cataloguing/framework?frameworkcode=&callback=define"
onscripterror https://HOST/intranet-tmp1/lib/require_18.0504000.js
Comment 1 David Cook 2023-06-14 06:59:26 UTC
It looks like none of the Javascript files (e.g. global_22.1103000.js) are compressed as they all have a Content-Type of "text/javascript" and Apache is only compressing "application/javascript".
Comment 2 David Cook 2023-06-14 07:05:43 UTC
Actually, I'm going to have to look over this more. I'm noticing Apache 2.4.52 Ubuntu calling some files text/javascript while Apache 2.4.56 Debian is calling the same files application/javascript. 

There's probably more going on there than I realize...