'spring cloud gw redis rate limiter don't show rate limiter information headers

In spring cloud gw redis rate limiter impl, there are headers infos like X-RateLimit-Remaining, X-RateLimit-Requested-Tokens, X-RateLimit-Burst-Capacity, X-RateLimit-Replenish-Rate. I dont want to give that information to clint due to some security issues.

There is a way to remove those headers on response even if request got 429?

Thanks



Solution 1:[1]

One potential solution to the problem is to configure special field for each instance of the RedisRateLimiter.

For example:

@Configuration
public class RateLimiterConfiguration {
    public RateLimiterConfiguration(List<RedisRateLimiter> rateLimiters) {
        rateLimiters.forEach(rateLimiter -> rateLimiter.setIncludeHeaders(false));
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1