Reputation: 25293
I've configured my Tomcat 6.0, installed on Linux server over AWS EC2, to compress large JSON object responses (~54k size) - but for some reason it's not compressing it.
Connector definition at /usr/share/tomcat6/conf/server.xml -
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000" compression="force"
compressableMimeType="text/html,text/xml,text/plain,application/javascript,application/json,text/javascript,text/json"
redirectPort="8443" />
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="200" scheme="https" secure="true" compression="force"
compressableMimeType="text/html,text/xml,text/plain,application/javascript,application/json,text/javascript,text/json"
keystoreFile="/usr/share/tomcat6/conf/my.keystore" keystorePass="password"
clientAuth="false" sslProtocol="TLS" />
Request headers, accepts gzip -
POST /mycommand HTTP/1.1
Host: my.host.com
Proxy-Connection: close
Accept-Encoding: gzip
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Content-Length: 431
Response headers, with MIME as configured at Connector -
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: application/json;charset=UTF-8
Vary: Accept-Encoding
Date: Mon, 27 Aug 2012 20:19:05 GMT
Connection: close
Content-Length: 55565
I've tried compressed="2048"
, same problem.
My command method at server is using Spring MVC with jackson JAR to create JSON responses -
@RequestMapping(method=RequestMethod.POST, value="/mycommand")
public @ResponseBody BasicResponse doCommand(
...
}
Any idea?
Upvotes: 2
Views: 4240
Reputation: 25293
OK, that's annoying...
It turns out that Burp Suite, the proxy I've been using to monitor all communication had unpack gzip / deflate
checked.
You have to scroll all the way down and uncheck it to receive compressed responses.
Once removed, everything works fine.
Upvotes: 2