LibraryActive

Spring Cloud Gateway

API gateway library that routes matching requests through a request-specific filter chain.

Open source page

Field note

What it does

Clients make requests to Spring Cloud Gateway. If the Gateway Handler Mapping determines a request matches a route, it is sent to the Gateway Web Handler, which runs it through a request-specific filter chain.

Capabilities

Available capabilities

Tags

Tags

Ways to use it

Ways to use it

sdk

java / org.springframework.cloud:spring-cloud-gateway

sdk

java / Not filed

other

Not filed / Not filed

sdk

java / org.springframework.cloud:spring-cloud-starter-gateway-server-webflux

Product features

Product features

AddRequestHeader GatewayFilter Factory

GatewayFilter factory that adds a header to the incoming request.

AddRequestHeader GatewayFilter

Adds a header to the downstream request for all matching routes using name and value parameters.

AddRequestHeadersIfNotPresent GatewayFilter Factory

Adds headers to downstream requests only if not already present, supporting multi-value headers and URI variables.

AddRequestParameter GatewayFilter Factory

GatewayFilter that takes a name and value and adds them to the downstream request's query string for all matching requests.

After Route Predicate Factory

Matches requests that happen after a specified ZonedDateTime.

Before Route Predicate Factory

Matches requests that happen before a specified ZonedDateTime.

Between Route Predicate Factory

Matches requests between two ZonedDateTime parameters.

Cookie Route Predicate Factory

Matches cookies by name whose values match a Java regular expression.

Default Route Ports

Route URIs without a port default to 80 for HTTP and 443 for HTTPS.

Enable/Disable

Set spring.cloud.gateway.enabled=false to disable the gateway.

Filter

GatewayFilter instances built from a factory that modify requests and responses.

Fully Expanded Arguments

Configure predicates and filters using name/args key-value pairs in YAML.

Gateway Filter Factories

Apply filters to matched routes to modify requests and responses.

Gateway Handler Mapping

Determines whether a request matches a configured route.

Gateway Web Handler

Runs the request through a filter chain specific to the request.

GatewayFilter Factories

Built-in factories that modify incoming HTTP requests or outgoing responses.

Header Route Predicate Factory

Matches a header whose value matches a Java regular expression.

Host Route Predicate Factory

Matches the Host header against Ant-style host name patterns.

Method Route Predicate Factory

Matches one or more HTTP methods such as GET or POST.

Netty Runtime

Requires the Netty runtime provided by Spring Boot and Spring WebFlux.

Path Route Predicate Factory

Matches Spring PathMatcher patterns with an optional matchTrailingSlash flag.

Pre and Post Filters

Filters can run logic both before and after the proxy request is sent.

Predicate

Java 8 Function Predicate taking a ServerWebExchange to match on HTTP request parts.

Proxy Exchange Variant

Exclusively for annotation based WebFlux or Web MVC applications, using a special ProxyExchange object.

Route

Basic building block defined by an ID, destination URI, predicates, and filters.

Route Predicate Factories

Match incoming requests to routes using configurable predicates such as Cookie.

Route URI Path Ignored

Any path defined on a route URI is ignored.

Server Variant

Full-featured API gateway that can be standalone or embedded in a Spring Boot application.

Shortcut Configuration

Configure predicates and filters by name followed by comma-separated argument values.

Spring Cloud Gateway Server WebFlux

WebFlux-based gateway server module for Spring Cloud Gateway.

Spring Framework Documentation

URI variable expansion

AddRequestHeader is aware of URI variables and expands them at runtime.

Web MVC Compatibility

Each flavor offers Web MVC compatibility.

WebFlux Compatibility

Each flavor offers WebFlux compatibility.

WebFlux and Web MVC Compatibility

Each flavor offers WebFlux and Web MVC compatibility.