DedupeResponseHeader GatewayFilter 工厂

DedupeResponseHeader GatewayFilter 工厂接受一个 name 参数和一个可选的 strategy 参数。name 可以包含一个以空格分隔的头名称列表。以下示例配置了一个 DedupeResponseHeader GatewayFilter

application.yml
spring:
  cloud:
    gateway:
      routes:
      - id: dedupe_response_header_route
        uri: https://example.org
        filters:
        - DedupeResponseHeader=Access-Control-Allow-Credentials Access-Control-Allow-Origin

这会在网关 CORS 逻辑和下游逻辑都添加 Access-Control-Allow-CredentialsAccess-Control-Allow-Origin 响应头的情况下,移除它们的重复值。

DedupeResponseHeader 过滤器还接受一个可选的 strategy 参数。接受的值为 RETAIN_FIRST(默认)、RETAIN_LASTRETAIN_UNIQUE

© . This site is unofficial and not affiliated with VMware.