RemoveResponseHeader GatewayFilter 工廠

RemoveResponseHeader GatewayFilter 工廠接受一個 name 引數。它是要移除的響應頭的名稱。以下列表配置了一個 RemoveResponseHeader GatewayFilter

application.yml
spring:
  cloud:
    gateway:
      routes:
      - id: removeresponseheader_route
        uri: https://example.org
        filters:
        - RemoveResponseHeader=X-Response-Foo

這將在響應返回到閘道器客戶端之前,從響應中移除 X-Response-Foo 響應頭。

為了移除任何敏感的響應頭,你應該為你希望這樣做的任何路由配置此過濾器。此外,你可以透過使用 spring.cloud.gateway.default-filters 一次性配置此過濾器,並將其應用於所有路由。

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