I am trying to disable TRACE and OPTIONS methods in the Tomcat level. I've been trying out different ways to implement this but get the same result on all cases during testing. I'm not very familiar with telnet (or any networking) but my manner of testing in cmd prompt is "telnet localhost 8080", then I paste the TRACE / HTTP/1.0 then press enter twice. Any help is greatly appreciated.
1.) NO CHANGES in CATALINA_HOME/conf/web.xml
2.) Adding security constraint in CATALINA_HOME/conf/web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>All Access</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method>OPTIONS</http-method>
<http-method>TRACE</http-method>
</web-resource-collection>
<auth-constraint />
</security-constraint>
3.) Add allowTrace="false" in Connector tag of CATALINA_HOME/conf/server.xml
4.) Add allowTrace="false" in Connector tag of CATALINA_HOME/conf/server.xml & Add xml to CATALINA_HOME/conf/web.xml's Default Servlet tag
<init-param>
<param-name>readonly</param-name>
<param-value>true</param-value>
</init-param>
Results on all cases
TRACE / HTTP/1.0 (404 Not Found)
OPTIONS / HTTP/1.0 (404 Not Found)
TRACE /(name of webservice) HTTP/1.0 (302 Found)
OPTIONS /(name of webservice) HTTP/1.0 (302 Found)
Tomcat was restarted after every change by issuing shutdown.bat and startup.bat. I'm obviously doing something wrong (testing/config) because I get the same result no matter what I change. I've read that I should be expecting a 405 error to signify that the http methods have been disabled.