I send a curl command with OPTIONS request method to my dropwizard application. I get a 200 Ok and POST and OPTIONS methods allowed as response.
How do i stop this from happening for security reasons as this provides some info about what are supported.
I tried implementing a custom request filter that responds with 405 not allowed for options method and added to a resource using NameBinding and but I think OPTIONS request does not reach at that point and so I am still getting 200OK and the same POST, OPTIONS plain text response.
I also tried using CrossOriginFilter.class in environment.servlets.addFilter() and configured it to not allow OPTIONS request. but that also did not work.
I got another post here : Disable OPTIONS Method Jetty Server
but how do i achieve this in dropwizard via java code ?