# WebDev and GZip compression?

**URL:** <https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396>\
**Category:** Ignition\
**Created:** [June 11, 2018, 2:42pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396 "2018-06-11T14:42:20Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [June 11, 2018, 2:42pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/1 "2018-06-11T14:42:20Z")

</div>

Posting this to the “Ignition” section to see if it gets more attention 🙂

Wondering if there is a way to enable caching and/or Gzip compression for REST Webdev calls? I would think that those are enabled at the Web Server level, but do we have access to those settings?

Adding more details here after some research:

It looks like on the later versions of Jetty, gzip compression is enabled via gzip.mod, and enabled via the jetty-gzip.xml or a “context xml” file. Not sure where those reside?  
[https://www.eclipse.org/jetty/documentation/9.3.22.v20171030/gzip-filter.html1](https://www.eclipse.org/jetty/documentation/9.3.22.v20171030/gzip-filter.html1)

In earlier versions, a gzip handler can be added to web.xml (/ignition/webserver/webapps/main/WEB-INF/web.xml); but that approach is no longer supported? Can someone confirm?

**IA Support has confirmed that enabling the above does not affect the Webserver and GZip compression is not turned on after.**

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [June 11, 2018, 6:08pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/2 "2018-06-11T18:08:46Z")

</div>

Edit: removed my solution as it only worked when .gz files were requested.

Courtesy of @PerryAJ :  
Add a file called jetty-web.xml to Ignition\webserver\webapps\main\WEB-INF with the following:

```auto

<?xml version="1.0" encoding="utf-8" standalone="no"?>
<Configure class="org.eclipse.jetty.webapp.WebAppContext">
    <Set name="GzipHandler">
        <New class="org.eclipse.jetty.server.handler.gzip.GzipHandler"/>
    </Set>
</Configure>

```

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/e/eb26924a6e0da037fe79dee7af6d3551e1711338.png)

Not sure if this will break anything else 😅

---

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [June 12, 2018, 12:41am UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/3 "2018-06-12T00:41:09Z")

</div>

Sweet! Thanks @ethan.thomason and @PerryAJ

I will test this on our dev server tomorrow.

Oscar

---

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [June 13, 2018, 12:42pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/4 "2018-06-13T12:42:21Z")

</div>

Quick update on this:  
Adding a jetty-web.xml file to Ignition\webserver\webapps\main\WEB-INF (with the content in your post) does not seem to have enabled Gzip compression on webdev calls to the Gateway.  
There is already a file in that folder called web.xml, should I just add to that file instead of adding a new file named differently?  
Here are the contents of the existing web.xml file:

```auto
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="SRGateway" version="2.5">
  <display-name>Ignition</display-name>
  <context-param>
  	<param-name>configuration</param-name>
  	<param-value>deployment</param-value>
  </context-param>
  <context-param>
    <param-name>lib.dir</param-name>
    <param-value>lib\</param-value>
  </context-param>
  <context-param>
    <param-name>data.dir</param-name>
    <param-value>data\</param-value>
  </context-param>
  <context-param>
    <param-name>userlib.dir</param-name>
    <param-value>user-lib\</param-value>
  </context-param>
  <context-param>
    <param-name>logs.dir</param-name>
    <param-value>logs\</param-value>
  </context-param>
  <context-param>
    <param-name>temp.dir</param-name>
    <param-value>temp\</param-value>
  </context-param>
  <context-param>
    <param-name>etc.dir</param-name>
    <param-value>/etc/ignition/</param-value>
  </context-param>
  <context-param>
    <param-name>org.eclipse.jetty.servlet.SessionIdPathParameterName</param-name>
    <param-value>none</param-value>
  </context-param>
  
  <filter>
  	<filter-name>WicketFilter</filter-name>
  	<filter-class>com.inductiveautomation.ignition.gateway.bootstrap.SRFilter</filter-class>
  	<init-param>
  	  <param-name>applicationClassName</param-name>
  	  <param-value>com.inductiveautomation.ignition.gateway.SRContext</param-value>
  	</init-param>
  	<init-param>
  	  <param-name>filterMappingUrlPattern</param-name>
  	  <param-value>/web/*</param-value>
  	</init-param>
  </filter>
  <filter-mapping>
  	<filter-name>WicketFilter</filter-name>
  	<url-pattern>/web/*</url-pattern>
  </filter-mapping>
  
  <servlet>
    <servlet-name>Map</servlet-name>
    <servlet-class>com.inductiveautomation.ignition.gateway.bootstrap.MapServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
  	<servlet-name>Map</servlet-name>
  	<url-pattern>/system/*</url-pattern>
  </servlet-mapping>

  <servlet>
      <servlet-name>Resources</servlet-name>
      <servlet-class>com.inductiveautomation.ignition.gateway.bootstrap.ResourceServlet</servlet-class>
      <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
      <servlet-name>Resources</servlet-name>
      <url-pattern>/res/*</url-pattern>
  </servlet-mapping>
  
  <servlet>
    <servlet-name>DataRoutes</servlet-name>
    <servlet-class>com.inductiveautomation.ignition.gateway.bootstrap.DataServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
    <multipart-config>
      <max-file-size>20848820</max-file-size>
      <max-request-size>418018841</max-request-size>
      <file-size-threshold>1048576</file-size-threshold>
    </multipart-config>
  </servlet>
  <servlet-mapping>
    <servlet-name>DataRoutes</servlet-name>
    <url-pattern>/data/*</url-pattern>
  </servlet-mapping>

  <servlet>
  	<servlet-name>Start</servlet-name>
  	<servlet-class>com.inductiveautomation.ignition.gateway.bootstrap.StartupServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>Start</servlet-name>
  	<url-pattern>/Start</url-pattern>
  </servlet-mapping>
  
  <servlet>
  	<servlet-name>StatusPing</servlet-name>
  	<servlet-class>com.inductiveautomation.ignition.gateway.bootstrap.StatusPingServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  	<servlet-name>StatusPing</servlet-name>
  	<url-pattern>/StatusPing</url-pattern>
  </servlet-mapping>
  
  <welcome-file-list>
  	<welcome-file>Start</welcome-file>
  </welcome-file-list>
</web-app>

```

I don’t see a section to plug the GzipHandler option in.

Thanks!  
Oscar.

---

<div class="post-metadata">

**Author:** ![oscar.salcedo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/oscar.salcedo/32/11019_2.png) [@oscar.salcedo](https://forum.inductiveautomation.com/u/oscar.salcedo)\
**Post date:** [June 13, 2018, 12:51pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/5 "2018-06-13T12:51:43Z")

</div>

Ignore that, I read the documentation and it does need to be a jetty-web.xml (or web-jetty.xml).

---

<div class="post-metadata">

**Author:** ![ethomason](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/ethomason/32/43338_2.png) [@ethomason](https://forum.inductiveautomation.com/u/ethomason)\
**Post date:** [June 13, 2018, 1:43pm UTC](https://forum.inductiveautomation.com/t/webdev-and-gzip-compression/18396/6 "2018-06-13T13:43:55Z")

</div>

Did you do a gateway restart after adding the file? How are you checking the compression (Chrome, Wireshark, etc) ? Any errors in the logs?
