Spring Cloud Gateway

This project provides a library for building an API Gateway on top of Spring MVC. 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.)..

Quick Start
Fork me on GitHub


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.
  • Hystrix Circuit Breaker integration.
  • Spring Cloud DiscoveryClient integration
  • Easy to write Predicates and Filters
  • Request Rate Limiting
  • Path Rewriting

Quick Start


The recommended way to get started using spring-cloud-gateway in your project is with a dependency management system – the snippet below can be copied and pasted into your build. Need help? See our getting started guides on building with Maven and Gradle.

public class Application {

  public RouteLocator customRouteLocator(ThrottleWebFilterFactory throttle) {
    return Routes.locator()
          .addResponseHeader("X-TestHeader", "foobar")
          .add(addResponseHeader("X-AnotherHeader", "baz"))

  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);


To run your own gateway use the spring-cloud-starter-gateway dependency.