Sitemap
Anshu Kulshrestha

Anshu Kulshrestha

.

Spring Cloud Gateway Architecture

1 min readJul 2, 2024

In the previous blog https://medium.com/@officialnot12/spring-cloud-gateway-da33e6500d0f, we discussed what is Spring Cloud gateway.
In this blog we will understand the internal architecture of spring cloud gateway

The components are as below
1. Gateway handler mapping using Route config: All the incoming request to API gateway are first verified if the request matches a route defined in route config.

2. Predicate: The request matching is done based on the predicate

3. Pre Filter: The request if matched with the route is further filtered ,as in the parameters passed in request matches certain value or not

Get Anshu Kulshrestha’s stories in your inbox

Join Medium for free to get updates from this writer.

4. Post Filter: The Post filter perform certain operation on received response from services, as in adding header.

Press enter or click to view image in full size

To create a spring cloud gateway for your microservices.
1. we need to add the dependency the below depdendency.
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-gateway</artifactId>
</dependency>

2. Add below properties in your YAML file for gateway server

spring:
application:
name: "gatewayserver"
config:
import: "optional:configserver:http://localhost:8071/"
cloud:
gateway:
discovery:
locator:
enabled: false
lowerCaseServiceId: true

management:
endpoints:
web:
exposure:
include: "*"
endpoint:
gateway:
enabled: true
info:
env:
enabled: true

info:
app:
name: "gatewayserver"
description: "Eazy Bank Gateway Server Application"
version: "1.0.0"

logging:
level:
com:
eazybytes:
gatewayserver: DEBUG

--

--