Activate gzip compression in wildfly configuration file (e.g. standalone.xml) using the gzip filter as follows:
<subsystem xmlns="urn:jboss:domain:undertow:1.2"> <server name="default-server"> <host name="default-host" alias="localhost"> <filter-ref name="gzipFilter" predicate="exists['%{o,Content-Type}'] and regex[pattern='(?:application/javascript|text/css|text/html|text/xml|application/json)(;.*)?', value=%{o,Content-Type}, full-match=true]"/> <filter-ref name="Vary-header"/> </host> </server> <filters> <gzip name="gzipFilter"/> <response-header name="Vary-header" header-name="Vary" header-value="Accept-Encoding"/> </filters> </subsystem>
This enables compression based on resource content type for javascript, html and css.
Important:
To make proxy servers happy, you have to add the Vary: Accept-Encoding header as shown above if you use gzip compression. For details see here.
Check the site using Google PageSpeed Insights, Firebug plugin for Firefox or Chrome developer tools. Or use online tools like Pingdom Website Speed Test.