如何从 zuul 路由中排除或忽略特殊路径或路由

How to exclude or ignore special paths or routes from zuul routing

是否可以从 Zuul 路由中排除路径或匹配器?

目标是

我有这样的配置:

zuul:
    routes:
        contract:
            path: /contracts/**
            url: http://contracts.example.com:8080/api
        audit:
            path: /audits/**
            url: http://audit.example.com:8080
        html:
            path: /**
            url: http://html.example.com:80

现在的问题是如何定义 /heartbeat/sso 不被路由到 html.example.com 来自 zuul?

我正在使用 Spring 引导及其自动配置。

有一个名为 ignored-patterns 的配置 属性。这样就可以定义匹配器以从路由中排除路由。

zuul:
    ignoredPatterns:
        - /heartbeat/**
        - /sso/**
    routes:
        contract:
            path: /contracts/**
            url: http://contracts.example.com:8080/api
        audit:
            path: /audits/**
            url: http://audit.example.com:8080
        html:
            path: /**
            url: http://html.example.com:80

Brixton.SR6 起,应在 application.yml 文件中以不同方式定义 ignoredPattern 属性。应该定义如下:

zuul:
ignoredPatterns: /heartbeat/**, /sso/**
routes:
    contract:
        path: /contracts/**
        url: http://contracts.example.com:8080/api