【问题标题】:I have the following yaml specification:我有以下 yaml 规范:
【发布时间】:2020-10-23 14:41:52
【问题描述】:

如何订购 FilterFactory

spring:
  cloud:
   gateway:
    routes:
    - id: test
      uri: http://httpbin.org:80
      predicates:
      - Path=/test/**
      filters:
      - name: RewritePath
        regexp: /test/(?<segment>.*) 
        replacement: /$\{segment}

但我也有自己的自定义过滤器

public class MyGlobalFilter implements GlobalFilter, Ordered {

这允许我指定顺序。
我不知道两件事:FilterFactory RewritePath 的订单号是多少?如何触发它在我自己的 MyGlobalFilter 之前或之后?

【问题讨论】:

    标签: spring-cloud-gateway


    【解决方案1】:

    (1) 'gateway.routes' 中定义的过滤器如果没有顺序,则自动从 1 开始排序。 (2)您可以使用内部的GatewayFilterFactory定义有序的GlobalFilter或OrderedGatewayFilterFactory。

    【讨论】:

      猜你喜欢
      • 2020-05-29
      • 1970-01-01
      • 2023-02-04
      • 1970-01-01
      • 2019-07-22
      • 2019-06-13
      • 2014-05-11
      • 2020-01-16
      • 2022-01-18
      相关资源
      最近更新 更多