How to register / debug invalid requests in tomcat?

On our system (closed system, java web application in tomcat 6 as a server, java fat clients), our clients sometimes show "400 - Bad Request" responses. I would like to debug this on the server side, but since the requests seem invalid, I don't see them anywhere. I configured AccessLogValve for the full tomcat node, but requests are not displayed there. I don’t even see anything in katalin.

I would really like these requests to be logged, and it would be even better to drop requests based on certain criteria.

Any ideas?

My server.xml looks like this:

<Server port="8005" shutdown="SHUTDOWN"> <Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="off" /> <Listener className="org.apache.catalina.core.JasperListener" /> <Listener className="org.apache.catalina.core.JreMemoryLeakPreventionListener" /> <Listener className="org.apache.catalina.mbeans.ServerLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.GlobalResourcesLifecycleListener" /> <Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener" rmiServerPortPlatform="9098" rmiRegistryPortPlatform="9099" useLocalPorts="true" /> <Service name="Catalina"> <Connector port="8020" protocol="HTTP/1.1" redirectPort="8010" connectionTimeout="20000" /> <Engine name="Catalina" defaultHost="localhost" jvmRoute="cc1"> <Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="false" deployOnStartup="true" xmlValidation="false" xmlNamespaceAware="false"> <Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs" prefix="access_log." suffix=".txt" pattern="combined" resolveHosts="false" /> </Host> </Engine> </Service> </Server> 
+6
source share
1 answer

a long time ago - but anyway: Tomcat has different valves that can help achieve this: http://tomcat.apache.org/tomcat-6.0-doc/config/valve.html#Request_Dumper_Valve

Another option would be tcpdump, as it is HTTP and a response code, it seems that you can filter the raw requests that cause this.

+1
source

Source: https://habr.com/ru/post/917784/


All Articles