I'm using a web.xml to try and disable the HTTP methods we're not using and to return a body that doesn't contain any tomcat info.
So I've changed the web.xml of the app to have:
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>TRACE</http-method>
<http-method>PUT</http-method>
<http-method>OPTIONS</http-method>
<http-method>DELETE</http-method>
<http-method>HEAD</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
So the blocked methods are returning 403 with an empty body, for forbidden. But TRACE is returning a 405 with a Tomcat HTML page.
I tried redirecting all errors through an ErrorServlet with:
<error-page>
<location>/ErrorServlet</location>
</error-page>
Which just makes sure that the content body is 0. But that doesn't seem to intercept these.
So why is TRACE being treated differently?
Thanks