2 Replies Latest reply on Jul 1, 2015 2:32 AM by valsaraj viswanathan

    HTML compression in WIldFly

    valsaraj viswanathan Master

      Hi,

       

      Is there any way to compress HTML in WildFly?

       

      Thanks!

        • 1. Re: HTML compression in WIldFly
          Tomaz Cerar Master

          <host ...>

             <location name="/" handler="welcome-content">

                <filter-ref name="static-gzip" predicate="path-suffix ['.html'] or path-suffix['.js'] or path-suffix ['.css'] or path-prefix['/resources']"/>

             </location>

             </host>

          </server>

          <filters>

          ...

             <gzip name="static-gzip"/>

          ....

          </filters>

          1 of 1 people found this helpful
          • 2. Re: HTML compression in WIldFly
            valsaraj viswanathan Master

            Thank you ctomc

             

            I have configured like this:

            <subsystem xmlns="urn:jboss:domain:undertow:1.2">

                            <buffer-cache name="default"/>

                            <server name="default-server">

                                <ajp-listener name="ajp" scheme="https" socket-binding="ajp"/>

                                <http-listener name="default" socket-binding="http"/>

                                <https-listener name="https-listener" socket-binding="https" security-realm="SSLRealm" max-post-size="1048576000"/>

                                <host name="default-host" alias="localhost">

                                    <location name="/" handler="welcome-content"/>

                                    <filter-ref name="server-header"/>

                                    <filter-ref name="x-powered-by-header"/>

                                    <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>

                            <servlet-container name="default">

                                <jsp-config/>

                                <websockets/>

                            </servlet-container>

                            <handlers>

                                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>

                            </handlers>

                            <filters>

                                <response-header name="server-header" header-name="Server" header-value="WildFly/8"/>

                                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>                   

                                <gzip name="gzipFilter"/>

              <response-header name="Vary-header" header-name="Vary" header-value="Accept-Encoding"/>

                            </filters>

                        </subsystem>

             

            With this configuration, I got JS, CSS, JSF, etc with Content-Encoding as gzip.