Route Filters

Page last updated:

The open-source Spring Cloud Gateway project includes a number of built-in filters for use in Gateway routes. Pivotal Spring Cloud Gateway provides a number of custom filters in addition to those included in the OSS project.

Filters Included In Spring Cloud Gateway OSS

Filters in Spring Cloud Gateway OSS can be used in Pivotal Spring Cloud Gateway. Spring Cloud Gateway OSS includes a number of factories for the GatewayFilter that is used to create filters for routes. For a complete list of these GatewayFilter factories, see the Spring Cloud Gateway OSS documentation.

Filters Added In Pivotal Spring Cloud Gateway

See the following sections for information about the custom filters added in Pivotal Spring Cloud Gateway.

Filters for Use with Pivotal SSO

Pivotal Spring Cloud Gateway adds a number of filters for use with the Pivotal Single Sign-On (Pivotal SSO) tile. For information about these filters, see Using Pivotal SSO in Route Configuration.

Limiting User Requests With the RateLimit Filter

The RateLimit filter limits the number of requests allowed from a given user to an app’s route within the specified time interval.

When adding a route to a Gateway service instance, you can add the RateLimit filter by including it in the list of filters in the JSON object for the route. For example, when binding an app called “cook” to a Gateway service instance, you can add a route for the app and use the RateLimit filter to limit users to one request every 10 seconds:

$ cf bind-service cook my-gateway -c '{ "routes": [ { "path": "/cook/**", "filters": ["RateLimit=1,10s"] } ] }'