PrefixPath GatewayFilter 工廠

PrefixPath GatewayFilter 工廠接受單一 prefix 參數。以下範例設定 PrefixPath GatewayFilter

application.yml
spring:
  cloud:
    gateway:
      routes:
      - id: prefixpath_route
        uri: https://example.org
        filters:
        - PrefixPath=/mypath

這會將 /mypath 作為所有符合請求路徑的前綴。因此,對 /hello 的請求會被發送到 /mypath/hello