I have a simple Spring Cloud Netflix Zuul in front of my services. I would like to set rate limiting for all requests coming to this Zuul.
I have seen this post: https://www.baeldung.com/spring-cloud-zuul-rate-limit However I have neither controllers in my Zuul or JPA repository. All routes Zuul receives from Eureka.
Zuul:
@SpringBootApplication
@EnableEurekaClient
@EnableZuulProxy
public class BlitzZuulApplication {
public static void main(String[] args) {
SpringApplication.run(BlitzZuulApplication.class, args);
}
}
application.properties:
spring.application.name=zuul
server.port = 7125
my.eureka.port=7126eureka.client.service-url.defaultZone=http://localhost:${my.eureka.port}/eureka
pom.xml:
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-zuul</artifactId>
</dependency>
<dependency>
<groupId>com.marcosbarbero.cloud</groupId>
<artifactId>spring-cloud-zuul-ratelimit-core</artifactId>
<version>2.2.4.RELEASE</version>
</dependency>
How to configure Zuul for rate limiting and restrict the number of overall incoming requests?