-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow ServletContext level removal of TRACE
from OPTIONS
response Allow
header
#403
Comments
I like this idea. Being able to control the default TRACE behaviour per ServletContext, whilst still allowing individual Servlets to override it would be a nice enhancement in 6.0. Now for the tricky part. What to call the new attribute? |
Having a high level switch, perhaps in the descriptor, to manage HTTP method usage? Using the Constraint mapping is just awkward and doesn't convey the proper behavior, as all you are doing is setting up an authentication requirement on a method and then having no realm for that method resulting in 100% rejection of that method. Idea 1: Descriptor level HTTP method include/exclude controls.Include / Exclude by HTTP method name? Each a list. <!-- reject TRACE, always remove from OPTIONS/Allow, allow all others as normal -->
<http-methods>
<exclude>TRACE</exclude>
</http-methods>
<!-- limited methods allowed, reject all others -->
<http-methods>
<include>GET</include>
<include>HEAD</include>
<include>POST</include>
<include>PUT</include>
</http-methods> Idea 2: Descriptor level HTTP method behavior.Allow specific methods to have hardcoded status and options-allow behavior. <!-- reject method TRACE as default behavior, hide from OPTIONS/Allow as default behavior. -->
<http-method>
<method>TRACE</method>
<status>405</status>
<options-allow>hide</options-allow>
</http-method>
<!-- default behavior is to return 404 for DELETE, default behavior is to always show DELETE in OPTIONS/Allow header. -->
<http-method>
<method>DELETE</method>
<status>404</status>
<options-allow>always</options-allow>
</http-method> |
This should probably also have ServletContext level methods to set/list/remove theses behaviors programmatically. What I don't know is ... Should this descriptor level configuration be a final decision like Constraint mapping where it overrides the application desires? Or should this descriptor level configuration only modify the default behavior in the HttpServlet base class? Allowing applications to override the behavior by implementing the appropriate |
Currently, the only way to remove TRACE from the OPTIONS response
Allow
header is to override thedoOptions
method on every servlet you implement.This isn't always feasible with 3rd party libraries and whatnot.
While there is a way to use Constraint mappings to disable TRACE (well, it actually returns "403 Not Authorized" instead of the more useful "405 Method Not Allowed") at the ServletContext level, there's no way to have that change also impact the OPTIONS
Allow
header at the same time.The text was updated successfully, but these errors were encountered: