Link

Enable GZIP Compression on app servers

GZIP Compression is a widely supported method of reducing the file size of the content that your App Server hosts. When using BuildVu we recommend adding this to .html, .css, .js, .svg, and .json files, as these cover all of the compressible format’s that BuildVu will produce. GZIP compression reduces bandwidth usage and improves load times, follow the instructions below to enable it.

GlassFish

  1. Open the GlassFish admin console (localhost:4848 for example)
  2. Go to the HTTP settings via: Configurations → server-config → Network Config → Network Listeners → http-listener-1/http-listener-2 (change the settings in both of these) → HTTP (tab at the top of the page)
  3. Edit the ‘Compression’ setting to be ‘on’
  4. Change the ‘Compressible Mime Types’ to use text/html,text/css,text/plain,text/javascript,application/javascript,application/json,image/svg+xml
  5. Click save and you’re done

Tomcat

  1. Open conf/server.xml
  2. Find <service name="Catalina">
  3. Find the <Connector /> tag inside it
  4. Add the following attributes to the Connector tag:
    • compression="on"
    • compressionMinSize="2048"
    • noCompressionUserAgents=""
    • compressableMimeType="text/html,text/css,text/plain,text/javascript,application/javascript,application/json,image/svg+xml"
  5. Restart the server and you’re done

Payara

  1. Open the Payara admin console (localhost:4848 for example)
  2. Go to the HTTP settings via: Configurations → server-config → Network Config → Network Listeners → http-listener-1/http-listener-2 (change the settings in both of these) → HTTP (tab at the top of the page)
  3. Edit the ‘Compression’ setting to be ‘on’
  4. Change the ‘Compressible Mime Types’ to use text/html,text/css,text/plain,text/javascript,application/javascript,application/json,image/svg+xml
  5. Click save and you’re done

Jetty

  1. Open etc/jetty.xml
  2. Find the <Configure id="Server" class="org.eclipse.jetty.server.Server"> tag
  3. Add in the following lines inside the Configure tag
    <Call name="insertHandler">  
        <Arg>  
            <New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler">  
                <Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" deprecated="gzip.minGzipSize" default="2048"/></Set>  
                <Set name="checkGzExists"><Property name="jetty.gzip.checkGzExists" deprecated="gzip.checkGzExists" default="false"/></Set>  
                <Set name="compressionLevel"><Property name="jetty.gzip.compressionLevel" deprecated="gzip.compressionLevel" default="-1"/></Set>  
                <Set name="inflateBufferSize"><Property name="jetty.gzip.inflateBufferSize" default="0"/></Set>  
                <Set name="syncFlush"><Property name="jetty.gzip.syncFlush" default="false" /></Set>  
                    
                <Set name="excludedAgentPatterns">  
                    <Array type="String">  
                        <Item><Property name="jetty.gzip.excludedUserAgent" deprecated="gzip.excludedUserAgent" default=".*MSIE.6\.0.*"/></Item>  
                    </Array>  
                </Set>  
                    
                <Set name="includedMethodList"><Property name="jetty.gzip.includedMethodList" default="GET" /></Set>  
                <Set name="excludedMethodList"><Property name="jetty.gzip.excludedMethodList" default="" /></Set>  
            </New>  
        </Arg>  
    </Call>  
    
  4. Restart the server and you’re done

Still need help? Send us your questions.