我在我的 spring cloud api 网关中使用 redis 实现了 ratelimit。这是一部分application.yml
:
spring:
cloud:
gateway:
httpclient:
ssl:
useInsecureTrustManager: true
discovery:
locator:
enabled: true
routes:
- id: test-rest-service
uri: lb://test-rest-service
predicates:
- Path=/test/**
filters:
- RewritePath=/test/(?<path>.*), /$\{path}
- name: RequestRateLimiter
args:
key-resolver: "#{@userRemoteAddressResolver}"
redis-rate-limiter.replenishRate: 2
redis-rate-limiter.burstCapacity: 3
我通过邮递员调用了 GET API 并检查了响应标头。
X-RateLimit-Remaining -1
X-RateLimit-Burst-Capacity 3
X-RateLimit-Replenish-Rate 2
速率限制不起作用。为什么我得到负值X-RateLimit-Remaining
?这是什么意思?我如何解决它?