Enabling gzip compression for Jboss
Asked Answered
N

4

11

How is gzip compression for Jboss 5.1.0 enabled?

Within the tomcat http connector right? I cant remember where this file is stored, server.xml?

Neoclassicism answered 8/6, 2010 at 2:26 Comment(0)
A
10

The file is under server.xml and you are correct in stating that you have to updated the http connector.

Following link is info for tomcat, but same applies to JBoss except location of server.xml file. I believe you need to update the server.xml under deploy\jbossweb.sar\

http://viralpatel.net/blogs/2008/11/enable-gzip-compression-in-tomcat.html

Alodee answered 8/6, 2010 at 3:40 Comment(0)
L
16

edit jboss\server\default\deploy\jbossweb.sar\server.xml

Edit this:

<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" 
           connectionTimeout="20000" redirectPort="8443" />

to be more like this:

<Connector protocol="HTTP/1.1" port="8080" address="${jboss.bind.address}" compression="on" 
compressableMimeType="text/html,text/xml,text/css,text/javascript, application/x-javascript,application/javascript" 
connectionTimeout="20000" redirectPort="8443" />

You can refer to connector config info for further details please see: http://tomcat.apache.org/tomcat-5.5-doc/config/http.html

Lovell answered 23/6, 2010 at 10:4 Comment(0)
D
15

To add gzip compression in JBoss 7.1.1, you can edit standalone/configuration/standalone.xml and add:

       ...
    </extensions>

    <system-properties>
        <property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION" value="on"/>
        <property name="org.apache.coyote.http11.Http11Protocol.COMPRESSION_MIME_TYPES" value="text/javascript,text/css,text/html"/>
    </system-properties>

Restart the server and check with developer tools or in the HTTP header if it is enabled.

Devol answered 14/8, 2012 at 9:28 Comment(2)
Hello @doonot I have implemented this code on my jBoss EAP 6.1 and It was working fine when I was working on my local server. But when I moved to actual server environment the changes are not getting reflected. My server is jBoss Server EAP 6.1 and is working on Linux OS. stackoverflow.com/users/569077/doonotTriecious
@doonot, I tried similar approach but not worked looks something I am missing it #41011980 please helpGingrich
A
10

The file is under server.xml and you are correct in stating that you have to updated the http connector.

Following link is info for tomcat, but same applies to JBoss except location of server.xml file. I believe you need to update the server.xml under deploy\jbossweb.sar\

http://viralpatel.net/blogs/2008/11/enable-gzip-compression-in-tomcat.html

Alodee answered 8/6, 2010 at 3:40 Comment(0)
P
2

In Jboss EAP 7.0 this worked for me:

edit: Standalone.xml

<subsystem xmlns="urn:jboss:domain:undertow:1.2">   <!-- SEARCH FOR THIS: urn:jboss:domain:undertow -->
  <buffer-cache name="default"/>  
  <server name="default-server">  
  <http-listener name="default" socket-binding="http"/>  
  <host name="default-host" alias="localhost">  
  (...)

  <!-- ADD THIS FOR GZIP COMPRESSION -->
  <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]"/>  
  <!-- /GZIP COMPRESSION -->

  </host>  
  </server>  
(...)  
  <filters>  
  (...)  

  <!-- ADD THIS FOR GZIP COMPRESSION -->
  <gzip name="gzipFilter"/>  
  <!-- /GZIP COMPRESSION -->

  </filters>  
</subsystem>

Restart the server

Prejudice answered 22/1, 2020 at 15:43 Comment(1)
This doesn't work on a domain setup on EAP 7.0.Phonemic

© 2022 - 2024 — McMap. All rights reserved.