My goal is to DISABLE HTTP TRACE method for my spring boot application, which is using embedded undertow.
A working yaml change will be preferred, if not, code changes are fine too. The end result should ideally be 4xx HTTP response code and no cookie value in response. [spring.mvc.dispatch-trace-request: false is giving 200 OK, so it's no good for me.]
Breaking my head on this, shouldn't be this hard!
To disable the default handling of trace in spring boot you can override the behaviour of the doTrace handler on the DispatcherServlet.
Adding this component to your spring config should do the trick. (Example is in Kotlin but you can convert to Java easily)
This generates this response for a TRACE request