SetPath GatewayFilter ファクトリ

SetPath GatewayFilter ファクトリは、パス template パラメーターを取ります。パスのテンプレート化されたセグメントを許可することにより、リクエストパスを操作する簡単な方法を提供します。これは、Spring Framework の URI テンプレートを使用します。複数の一致するセグメントが許可されます。次の例では、SetPath GatewayFilter を構成します。

application.yml
spring:
  cloud:
    gateway:
      server:
        webflux:
          routes:
          - id: setpath_route
            uri: https://example.org
            predicates:
            - Path=/red/{segment}
            filters:
            - SetPath=/{segment}

/red/blue のリクエストパスの場合、これにより、ダウンストリームリクエストを行う前にパスが /blue に設定されます。