Skip to content
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

spring-cloud-gateway-mvc's ProxyExchange no longer ignores client errors when combined with Spring 6.2 #3604

Open
jkuipers opened this issue Nov 26, 2024 · 3 comments
Labels
Milestone

Comments

@jkuipers
Copy link
Contributor

jkuipers commented Nov 26, 2024

Starting with 6.2.0, Spring Web's DefaultResponseErrorHandler has changed in such a way that org.springframework.cloud.gateway.mvc.config.ProxyResponseAutoConfiguration.NoOpResponseErrorHandler is no longer an actual no-op implementation. This results in client errors becoming exceptions instead of being proxied as-is, which is a very breaking change! UPDATE: only true for release train 2023.0.3, not for latest 2024.0.0-RC1: I didn't check when reporting

The real bug is that the code does not simply implement the ResponseErrorHandler interface but extends the DefaultResponseErrorHandler while making assumptions about its implementation that no longer hold.
The fix therefore is to implement a new trivial NoOpResponseErrorHandler directly: I would recommend to (also) implement the hasError method by returning false, which is even more efficient than having an empty handleError impl.

@spencergibb
Copy link
Member

Is there a simple way to reproduce this?

@jkuipers
Copy link
Contributor Author

proxy-exchange-errorhandling.zip
Here's a small sample project

@jkuipers
Copy link
Contributor Author

Oh, while creating the sample project I just noticed that the relevant code has been updated in the latest release candidate: I didn't see that before. I do still think that the fix is not very good because the code should just implement the interface rather than adapt to the default impl by overwriting more methods (not futureproof, no compiler warnings if the impl ever changes again) but my bug report is invalid / only applicable to the released version of spring-cloud-gateway-mvc, which isn't officially compatible with Spring web 6.2.0 I guess.
So feel free to close this issue as invalid / already fixed, but please consider to change the implementation to just implement the interface rather than extending the DefaultResponseErrorHandler as it's simpler and safer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

2 participants