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.