Magnolia Compatibility


The HTML Compressor module helps to keep the size of a responses to a minimum. By reducing the response size we will increase transfer speed while decreasing the bandwidth.  


Maven is the easiest way to install the module. Add the following dependency to your bundle:

  <version>5.7</version> <!-- Magnolia 5 & 6 -->


The source for this module can be found here:

Issues, Bugs and Improvements

Please comment at the bottom of this page.


The module uses a filter to compress html responses to a minimum size.


The filter is highly configureable. Using bypasses and mappings just about any file could be compressed. 

The module provides an additional filter extending from OncePerRequestAbstractMgnlFilter with two additional configurations: 

Class: info.magnolia.html.compressor.filter.HtmlCompressorFilter



Should the filter compress style blocks within HTML files.


optional, false

Should the filter compress script blocks within HTML files.


There are four bypass configurations bootstrapped with the filter. These bypasses help control which files should be minimized and which files should not be minimized.

  • extensions: This configuration controls which types of files should be minimized. By default only requests for HTML. Here you can add additional extensions as necessary.

    This configuration has a not property reversing the logic and essentially turning the bypass into a mapping. In other words, do not bypass these allowed extensions. This is how to map requests using extension found in the AggregationState.

  • admincentral: Requests to /.magnolia/admincentral are not minimized.
  • vaadin-resources: Requests to resources in a VAADIN folder are not minimized. 
  • minimized: Requests to resources which contain .min. are not minimized. It's assumed that this is a flag in the filename indicating the file is already in a minimized state. Further processing is not needed.


By default there are not any mappings configured but you can map specific URIs to the filter. For example, rather than use an entire extension to map you can target specific files or folders by using a mapping configuration. 


Here is an example using the contact page from the demo site.

With compression:

Without compression:


  • Compression will add more time to the initial request of the page. However, it will reduce the size of the file in the cache.
  • Careful when changing mappings. While it's possible to compress any file type in some cases, such as admincentral, minimizing supporting files can break the application. 
  • Using compressJavaScript can lead to exceptions. If you do embed JavaScript it's a good idea to check the compression in UAT.  MGNLDEMO-332 - Getting issue details... STATUS  



  1. Hi,

    It will be very helpfull to see an example for Mappings configuration. Right now using the extensions configuration it's working only if we don't have user friendly url. For example if we have the url /home.html it's working, but if we use it /home it's not working anymore since it's not recognizing the extension html.

    Thank you. 

    1. Hello-

      Please create your own account for commenting. You can signup here:!default.jspa

      You can see an example of the mapping here: server/filters/servlets/RestDispatcherServlet/mappings

      Create the mapping first then delete the bypasses node. 


  2. Hi Richard Gange ,

    I'm currently testing the HTML Compressor filter for a client on Magnolia 6.2.7.

    We've found that when we have the HTML Compressor filter enabled, the Pages app is failing to load area and component toolbars and the action bar fails to list any actions.

    We have the filter configured with the default installed bypass voters, and we have disabled js and css compression as these resources are already compressed. Either on or off, the same issue presents however.

        'class': ''
        'not': 'true'
          'html': 'html'
        'class': ''
        'pattern': '/.magnolia/admincentral'
        'class': ''
        'pattern': '/VAADIN'
        'class': ''
        'pattern': '*.min.*'

    I'd also confirm that the htmlCompressor filter is directly under the cache filter which is also enabled.

    Have you any ideas/ suggestions as to what may be causing our problem?

    Many thanks,

    Mark Nelson

    1. Hello Mark-

      When loading the Pages app do you see any errors in the browser console? Typically when the actionbar disappears this means there is invalid markup within the page itself. It might be helpful to send the raw source through an HTML validator. 



      1. Hi Rich,

        Thanks for your quick response.

        There was one or two innocuous js errors in the console, which I eliminated , however this hasn't resolved the issue unfortunately.

        I ran the Tidy HTML validator on the source. There are 0 errors, and 175 warnings. The warnings of which almost all are warnings of proprietary attribute use on svg element, an empty span or href without value. Nothing that appears would break the page as it's well formed.

        If you have any further thoughts on what could be the cause, would much appreciate your input.



        1. I would still think it has something to do with this page in particular. I've seen this type of thing before and it's pretty much always something to do with the embedded page. How many components are on this page? I'd make a copy and slowly start removing things until the problem goes away. 

          Once I did see something related to variant nodes effecting the page rendering. If a page had variants and then they were removed. It can leave behind mixin values that produce inconsistent results.