Pierre P. Pierre P. - 1 year ago 116
Apache Configuration Question

gzip compression results in empty response on bad request, works fine otherwise

I am doing a HTTP POST request from a web client using angular with the following header:

Accept-Encoding: gzip, deflate, br

The server response content-type is application/json. When the response status is 200, everything works fine, my response has a body that I can see from the client. However, when the response status is 400, the response body is empty according to the client, but I am certain I am populating it on the server. Also, if I remove "gzip" from the request header above (no change server-side whatsoever), then everything works fine even with a 400 response status, in other words I can see the response body from the client. I'm running Tomcat with Spring on the server side.

It really seems like gzip is the cause of my problem here, but I don't understand why or how to fix it, any help would be appreciated.

Thanks in advance.

Answer Source

We figured it out, we were using an old version of the ehcache-web library and thus its GZipFilter, which didn't return the response body for any status other than 200. Upgrading to version 2.0.4 of that library fixed the issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download