Reputation: 37
I cannot play with ratelimiter of spring cloud gateway. Here I config gateway:
spring:
cloud:
gateway:
discovery:
locator:
enabled: true
routes:
#Admin
- id: haft-upms-admin
uri: lb://haft-upms-admin
predicates:
- Path=/admin/**
filters:
- name: RequestRateLimiter
args:
key-resolver: '#{@remoteAddrKeyResolver}'
redis-rate-limiter.replenishRate: 1
redis-rate-limiter.burstCapacity: 1
- name: Hystrix
args:
name: default
fallbackUri: 'forward:/fallback'
I use JMeter to call API loop 1000 times but gateway not response 429 too many request in response. Where I wrong?
Upvotes: 0
Views: 1436
Reputation: 1
Firstly, your access url are wrong, which can not match route id:haft-upms-admin
, so can not invoke redis RequestRateLimiter
. You can see debug log like:
, you can check if match route id.
Secondly, you can read my config file:
Path is:localhost:xxxx/eureka-client/XXXX
will forward to my service eureka-client
and match route id my_coute1, so you can refer to my sample
all in all, you must match you route id.
Upvotes: -2