有两种方法可以通过RouteLocator中的bean或通过属性添加请求和响应标头。然而,我们需要一个示例来通过bean添加默认过滤器(如下),因为service-response-value
和service-request-value
将是一个动态值:
spring
cloud:
gateway:
default-filters:
- AddRequestHeader= service-request, service-request-value
- AddResponseHeader= service-response, service-response-value
Spring Cloud Gateway不支持通过bean的默认过滤器
https://github.com/spring-cloud/spring-cloud-gateway/issues/263