You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To simplify the test, I omitted the definition of a KeyResolver so that the RequestRateLimiter filter always blocks the request (“EMPTY_KEY”) with HTTP code 403.
I think the issue occurs because RequestRateLimiter sets the response as completed (when limit exceeds) and then you can no longer change the HTTP headers.
The only workaround I found is to create my own version of some basic filters so that they perform a check if the response has already been completed, for example my version of the RemoveResponseHeader:
I found a problem using the RequestRateLimiter filter in combination with those that alter the response headers such as RemoveResponseHeader.
I'm using Spring Cloud Gateway 4.2.0.
When RedisRateLimiter blocks a request, for limit exceeds, we get an exception (and 500 HTTP response code):
This is my configuration:
To simplify the test, I omitted the definition of a KeyResolver so that the RequestRateLimiter filter always blocks the request (“EMPTY_KEY”) with HTTP code 403.
I think the issue occurs because RequestRateLimiter sets the response as completed (when limit exceeds) and then you can no longer change the HTTP headers.
The only workaround I found is to create my own version of some basic filters so that they perform a check if the response has already been completed, for example my version of the RemoveResponseHeader:
If this is the solution, maybe a similar check should be added to all filters included in the project that may have this issue.
If there are any other solutions please let me know.
You can see a full example here: https://github.com/LorenzoLuconi/spring-cloud-gateway-exception-exmple
The text was updated successfully, but these errors were encountered: