Uploaded image for project: 'Cache Modules'
  1. Cache Modules
  2. MGNLCACHE-192

Javascript resources not gzip compressed due to misconfiguration

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.5.7, 5.6.1
    • Component/s: None
    • Labels:
      None
    • Release notes required:
      Yes
    • Sprint:
      Basel 126, Basel 127
    • Story Points:
      0.5
    • Magnolia Release:
      5.5.8, 5.6.1

      Description

      By default magnolia is configured to (gzip) compress html, js, and css resources. This is configured at: /modules/cache/config/compression/voters/contentType/allowed

      CSS and HTML are correctly compressed, but JS files are not because their actual mimetype is "application/javascript" - while the compression config specifies "application/x-javascript".

      Possible solution: change js entry to "application/javascript" entry, or add an additional one.

      Ensure that the same mimetype is used for JS everywhere.
      Also check the rest of the configuration for potential js mime-type misconfiguration - for example:
      /modules/cache/config/contentCaching/defaultPageCache/browserCachePolicy/policies/resources/voters/contentType/allowed
      (ie search for "application/javascript" and "application/x-javascript" in config app.)

      To reproduce:
      Run magnolia locally. (Our public demo seems to compress JS in another way.)
      Open a page in chrome - like http://localhost:8080/magnoliaAuthor/travel/about.html
      Open the devtools and switch to "network" tab.
      Click on a css file, (like: bootstrap.min....css) And notice Response Headers has Content-Encoding: gzip.

      Click on a js file (like respimage.min...js) And notice that Response Headers has no Content-Encoding (Note that this file is 8634 bytes when not compressed, and around 4000 when compressed.

      Big thanks to Marvin Kerkhoff for reporting.

        Attachments

          Activity

            People

            • Assignee:
              mmichel Maxime Michel
              Reporter:
              czimmermann Christopher Zimmermann
            • Votes:
              6 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Date of First Response: