Gzip Compression for HTTP Responses
IDM uses the Jetty Gzip handler to compress HTTP responses. The default Gzip handler configuration, in conf/jetty.xml
, is as follows:
... <Call name="insertHandler"> <Arg> <!-- https://www.eclipse.org/jetty/documentation/9.4.x/gzip-filter.html --> <New id="GzipHandler" class="org.eclipse.jetty.server.handler.gzip.GzipHandler"> <Set name="minGzipSize"><Property name="jetty.gzip.minGzipSize" default="2048"/></Set> <Set name="compressionLevel"><Property name="jetty.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"> <!-- IE 6 has known bugs related to GZIP compression --> <Item><Property name="jetty.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> ...
Adjust this configuration if the default does not suit your deployment. Configuration properties are as follows:
minGzipSize
Content is compressed only if the content length is unknown or is greater than the
minGzipSize
. By default, content is compressed only if the response is greater than 2048MB.compressionLevel
The compression level (
1-9
, with1
being the fastest compression speed but a lower compression ratio, and9
being the highest compression ratio but lowest compression speed. The default configuration sets the compression level to-1
, which indicates that the application should use the default. The default Gzip handler uses level6
, favoring higher compression over speed.inflateBufferSize
Number of bytes in the request decompression buffer. The default setting is
-1
, which disables this feature. Use this feature only if you want to compress large POST/PUT request payloads. Be aware that this setting exposes a potential Zip bomb risk.syncFlush
By default, this setting is
false
, which lets the deflater determine how much data to accumulate, before it produces output. This achieves the best compression. Whentrue
, this setting forces flushing of the buffer of data to compress. This can result in poor compression.excludedAgentPatterns
A list of regex patterns for User-Agent names. Requests from these names should not be compressed.
includedMethodList
A list of HTTP methods to compress. By default, only GET requests are compressed.
excludedMethodList
A list of HTTP methods that should not be compressed.