I have a Java-Servlet based web application using spring saml and Modsecurity.
For one of the GET requests (URL - /saml/login), the response is a HTML page returned as text/html(I can read the html file in browser network tools) along with Content-Length header. This is when Modsecurity is disabled.
When I enable ModSecurity in the app, the same response is returned with header Transfer-encoding: chunked. This time the html response is encoded due to chunking. Eg <html
is displayed as 10<60h104t116m109l108
. I am not sure if the browser is supposed to be decoding this but this is breaking the flow of my application. As the response is shown on the browser in the encoded form.
I have tried commenting out rules in ModSecurity to find out which is causing the response to be chunked with no success. Since another developer implemented ModSecurity, at this point I am not sure how solve this by making changes to ModSecurity.
Thus I want to try to decode the response in Java code or on the browser. If the Html file is rendered normally, the subsequent requests will start working.
EDIT 1:
ModsecurityFilter configuration in the web.xml:
<filter>
<filter-name>ModSecurityFilter</filter-name>
<filter-class>org.modsecurity.ModSecurityFilter</filter-class>
<init-param>
<param-name>conf</param-name>
<param-value>/opt/ModSecurityFilter/modsecurity.conf</param-value>
</init-param>
<init-param>
<param-name>libxml2</param-name>
<param-value>/usr/lib/x86_64-linux-gnu/libxml2.so.2</param-value>
</init-param>
<init-param>
<param-name>libpcre</param-name>
<param-value>/lib/x86_64-linux-gnu/libpcre.so.3</param-value>
</init-param>
<init-param>
<param-name>libaprutil-1</param-name>
<param-value>/usr/lib/x86_64-linux-gnu/libaprutil-1.so.0</param-value>
</init-param>
<init-param>
<param-name>libapr-1</param-name>
<param-value>/usr/lib/x86_64-linux-gnu/libapr-1.so.0</param-value>
</init-param>
<init-param>
<param-name>libModSecurityJNI</param-name>
<param-value>/opt/ModSecurityFilter/java/.libs/libModSecurityJNI.so</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>ModSecurityFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>