SetRequestHostHeader GatewayFilter 工廠

在某些情況下,可能需要覆蓋 Host 請求頭。在這種情況下,SetRequestHostHeader GatewayFilter 工廠可以用指定的值替換現有的 Host 請求頭。該過濾器接受一個 host 引數。以下列表配置了一個 SetRequestHostHeader GatewayFilter

application.yml
spring:
  cloud:
    gateway:
      routes:
      - id: set_request_host_header_route
        uri: https://:8080/headers
        predicates:
        - Path=/headers
        filters:
        - name: SetRequestHostHeader
          args:
            host: example.org

SetRequestHostHeader GatewayFilter 工廠會將 Host 請求頭的值替換為 example.org

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