I am in the process of developing a Spring Cloud based API Gateway. This Gateway acts like a proxy that filters multiple JSON API requests/responses The gateway has multiple routes that are defined for each JSON API. I have found a way to define global Request and Response transform filters. But I believe that these global filters will operate on all routes. I would like each route to be defined in the application.properties, along with a route-specific or local if you may request/response filters. The route definitions in the applications.properties would be defined as: ##Spring Cloud API Gateway Properties ### Route 1 spring.cloud.gateway.routes[0].id=route1 spring.cloud.gateway.routes[0].uri=https://example.com spring.cloud.gateway.routes[0].predicates[0]=Path=/test1 spring.cloud.gateway.routes[0].predicates[1]=Method=POST spring.cloud.gateway.routes[0].filters[0]=SetPath=/test1 spring.cloud.gateway.routes[0].filters[1]=RewritePath=/test1, /dest1 ### Route 2 spring.cloud.gateway.routes[1].id=route2 spring.cloud.gateway.routes[1].uri=https://example.com spring.cloud.gateway.routes[1].predicates[0]=Path=/test2 spring.cloud.gateway.routes[1].predicates[1]=Method=POST spring.cloud.gateway.routes[1].filters[0]=SetPath=/test2 spring.cloud.gateway.routes[1].filters[1]=RewritePath=/test2, /dest2 What is the best way now to define for each of route1, route2, .... routen, custom route specific request and response transform filters and configuring them for the routes.
@Component public class RequestTransformationFilter implements GlobalFilter, Ordered { }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)