-
Notifications
You must be signed in to change notification settings - Fork 38.3k
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
As discussed with @chemicL, this is a limitation of the current design which is using a WebFilter
. The exception handling mechanism is applied with ExceptionHandlingWebHandler
, which is a HttpHandlerDecorator
. WebFilter
instances are applied at a higher level and are not aware of this.
#31303
Comments
Recently, I've been programming Spring Webflux On the 3.1.4 version. I've also used Spring Security and the type of the token is JWT. If the token is not valid, the Security Class will throw an exception. Although the throw goes through the ErrorWebExceptionHandler Class, it does not arrive in the WebFilter Class. This issue just happens when an exception in the Security Class, but in the rest of the cases, it works correctly. |
#30013 has been fixed. What is the purpose of this issue? |
I use WebFilter for making general Exceptions and Logging for Logstash in the WebFilter layer. It just does not work correctly in the Security Level means that the Security Class throws an Exception and WebFilter can not Catch it in the doOnError Method, but it works correctly in other cases. |
I use WebFilter for making general Exception Handlings and Logging for Logstash in the WebFilter layer. It just does not work correctly in the Security Level means that the Security Class throws an Exception and WebFilter can not Catch it in the doOnError Method, but it works correctly in other cases. |
In my opinion, the ErrorWebExceptionHandler can be removed and the WebFilter just exists. |
The WebFilter level was the wrong level for instrumentation. We have fixed that in #30013 already. Did you check with the latest milestones? I'm closing this issue as there is nothing actionable here. |
According to the following code in my WebFilter level, I expect after each request, if there is an exception, the doOnError Method will catch it, but if I throw an exception in Security levels does not work truly at least for me on my project. Of course, In other cases works correctly. On the other hand, according to #30013, it was told "this is a limitation of the current design which is using a WebFilter. The exception handling mechanism is applied with ExceptionHandlingWebHandler, which is a HttpHandlerDecorator. WebFilter instances are applied at a higher level and are not aware of this." @OverRide return webFilterChain.filter(exchangeDecorator)
} |
This limitation is serious enough that I'm considering this a bug and should be fixed in 6.0.x. A possible solution would be to reimplement the instrumentation as a
HttpHandlerDecorator
itself, but this needs to validated. I'm scheduling this issue for 6.0.x but this can be revisited depending on our findings withHttpHandlerDecorator
. As a result, the existingWebFilter
should be deprecated.Originally posted by @bclozel in #30013 (comment)
The text was updated successfully, but these errors were encountered: