Search code examples
bolt-cms

Adding GZIP compression to Bolt CMS


Id like to GZIP compress my output from Bolt CMS.

I have had a look in YAML files and there doesnt seem to be a setting.

is there a way to do this ?


Solution

  • This is not done at the application layer, rather in your web server configuration for that virtual site.

    In Apache something similar to this should work:

    <ifModule mod_gzip.c>
    mod_gzip_on Yes
    mod_gzip_dechunk Yes
    mod_gzip_item_include file .(html?|css|php|txt)$
    mod_gzip_item_include handler ^cgi-script$
    mod_gzip_item_include mime ^text/.*
    mod_gzip_item_include mime ^application/x-javascript.*
    mod_gzip_item_exclude mime ^image/.*
    mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
    </ifModule>