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