GateWay 中StripPrefix的作用

 

StripPrefix网关过滤器工厂采用一个参数StripPrefix。 StripPrefix参数表示在将请求发送到下游之前从请求中剥离的路径个数。

spring:
  cloud:
    gateway:
      routes:
      - id: crm
        uri: http://crm
        predicates:
        - Path=/crm/**
        filters:
        - StripPrefix=2

 

当通过网关向/name/bar/foo发出请求时,对nameservice的请求将类似于http://crm/foo。

posted @ 2020-02-22 17:52  图生  阅读(29521)  评论(0)    收藏  举报