Spring Cloud Gateway
3.1.3This project provides a library for building an API Gateway on top of Spring WebFlux. Spring Cloud Gateway aims to provide a simple, yet effective way to route to APIs and provide cross cutting concerns to them such as: security, monitoring/metrics, and resiliency.
Features
Spring Cloud Gateway features:
-
Built on Spring Framework 5, Project Reactor and Spring Boot 2.0
-
Able to match routes on any request attribute.
-
Predicates and filters are specific to routes.
-
Circuit Breaker integration.
-
Spring Cloud DiscoveryClient integration
-
Easy to write Predicates and Filters
-
Request Rate Limiting
-
Path Rewriting
Getting Started
@SpringBootApplication
public class DemogatewayApplication {
@Bean
public RouteLocator customRouteLocator(RouteLocatorBuilder builder) {
return builder.routes()
.route("path_route", r -> r.path("/get")
.uri("http://httpbin.org"))
.route("host_route", r -> r.host("*.myhost.org")
.uri("http://httpbin.org"))
.route("rewrite_route", r -> r.host("*.rewrite.org")
.filters(f -> f.rewritePath("/foo/(?<segment>.*)", "/${segment}"))
.uri("http://httpbin.org"))
.route("hystrix_route", r -> r.host("*.hystrix.org")
.filters(f -> f.hystrix(c -> c.setName("slowcmd")))
.uri("http://httpbin.org"))
.route("hystrix_fallback_route", r -> r.host("*.hystrixfallback.org")
.filters(f -> f.hystrix(c -> c.setName("slowcmd").setFallbackUri("forward:/hystrixfallback")))
.uri("http://httpbin.org"))
.route("limit_route", r -> r
.host("*.limited.org").and().path("/anything/**")
.filters(f -> f.requestRateLimiter(c -> c.setRateLimiter(redisRateLimiter())))
.uri("http://httpbin.org"))
.build();
}
}
To run your own gateway use the spring-cloud-starter-gateway
dependency.
Quickstart Your Project
Documentation
3.1.3 CURRENT GA | Reference Doc. | |
4.0.0-M3 PRE | Reference Doc. | |
3.1.4-SNAPSHOT SNAPSHOT | Reference Doc. | |
3.0.5-SNAPSHOT SNAPSHOT | Reference Doc. | |
3.0.4 GA | Reference Doc. | |
2.2.10.BUILD-SNAPSHOT SNAPSHOT | Reference Doc. | |
2.2.9.RELEASE GA | Reference Doc. |
Guides
Branch | Initial Release | End of Support | End Commercial Support * |
---|---|---|---|
3.1.x
|
2021-11-30 | 2023-05-18 | 2024-08-22 |
3.0.x
|
2020-12-21 | 2022-05-19 | 2023-09-19 |
2.2.x
|
2019-11-26 | 2020-11-26 | 2022-03-26 |
OSS support
Free security updates and bugfixes with support from the Spring community. See VMware Tanzu OSS support policy.
Commercial support
Business support from Spring experts during the OSS timeline, plus extended support after OSS End-Of-Life.
Publicly available releases for critical bugfixes and security issues when requested by customers.
Future release
Generation not yet released, timeline is subject to changes.