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