Spring Cloud Gateway
Cora Iberkleid
@ciberkleid
Developer Advocate, VMware
API Gateway Role & Responsibilities
● Routing
● Security
● Monitoring
● Canarying
● Resiliency
● Monolith Strangling
G
A
T
E
W
A
Y
Server Side
MVC App
Microservice A
JS or
Mobile App
Microservice B
Microservice C
API Gateways - Then and Now
Many API Management Gateways can be dated
back to SOA and these tend to have been
implemented as centralized servers. But as
microservices became more popular, modern
lightweight independent and decentralized
micro-gateway applications have appeared –
such as Spring Cloud Gateway.
Source: Ben Wilcock
https://spring.io/blog/2019/06/18/getting-started-with-spring-cloud-gateway
〝
〞
Spring Cloud Gateway
Basics
Spring Cloud Gateway Foundations
Reactive Gateway
Gateway Flow
Client Predicates Pre-Filters Global Filters
Post-Filters
Downstream
Service
Gateway
Handler Mapping Web Handler
Gateway Flow
Client Predicates Pre-Filters Global Filters
Post-Filters
Downstream
Service
Gateway
Handler Mapping Web Handler
Predicates
● Date/Time
● Cookies
● Headers
● Host
● Method
● Path
● Query Params
● Remote Address
● Weight
Gateway Flow
Client Predicates Pre-Filters Global Filters
Post-Filters
Downstream
Service
Gateway
Handler Mapping Web Handler
Pre-Filters
● Headers
● Parameters
● Path
● Circuit Breaker
● Retry
● Rate Limiter
● Redirect
● Save Session
● Size
● Host
● Metrics
● Modify Body
Gateway Flow
Client Predicates Pre-Filters Global Filters
Post-Filters
Downstream
Service
Gateway
Handler Mapping Web Handler
Global Filters
● Netty Router
● Web Sockets
● Load Balancer
● Metrics
Gateway Flow
Client Predicates Pre-Filters Global Filters
Post-Filters
Downstream
Service
Gateway
Handler Mapping Web Handler
Post Filters
● Set Status
● Headers
● Modify Body
Routes: building blocks of a gateway
Defined by:
● ID
● Destination URI
● Collection of predicates (for matching requests to the route)
● Collection of filters (for modifying the request or response)
Specified as:
● Java
● Properties
Demo
TD Ameritrade @ SpringOne 2019
Poornima Rajendhran
Michael Dennis
Mounika Kikkuru
youtube.com/watch?v=TzKlxr5R-Ew&t=93s
Saravanan Paramasivam
Chris Jackson
youtube.com/watch?v=RRMO4oNptoQ
SpringOne 2023, Las Vegas
References
Demo:
https://github.com/ciberkleid/spring-cloud-gateway-sample
Spring Cloud Gateway:
https://spring.io/projects/spring-cloud-gateway
https://cloud.spring.io/spring-cloud-gateway/reference/html
Thank you! Questions?
Cora Iberkleid
@ciberkleid

Spring Cloud Gateway - SpringOne Tour 2023 Charles Schwab.pdf