I have a web-app developed using Spring-MVC, Spring-Security and hosted on Tomcat 7. As a security measure, I have also whitelisted only certain HTTP methods in web.xml as follows:
<security-constraint>
<web-resource-collection>
<web-resource-name>restricted methods</web-resource-name>
<url-pattern>/*</url-pattern>
<http-method-omission>GET</http-method-omission>
<http-method-omission>POST</http-method-omission>
<http-method-omission>DELETE</http-method-omission>
</web-resource-collection>
<auth-constraint />
</security-constraint>
At this point, what I would expect is that if I made an excluded http method call to any endpoint, then I would get a 403 response - and this setup works. But the 403 response also includes a "Allow" header as follows:
Allow: GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, PATCH
- Is blacklisting OPTIONS not a supported/recommended thing?
- Why is the list of allowed http methods different from what I have configured?
- I'm assuming Tomcat is the one adding the Allow header to the response - is that right?
- And how can I configure tomcat (or spring if that is adding the header) to not add this header to the response?