Erkan Erkişi
Erkan Erkişi

Reputation: 159

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

Upvotes: 1

Views: 427

Answers (1)

StateItPrimitive
StateItPrimitive

Reputation: 149

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));
    }
}

Upvotes: 0

Related Questions