如何从 zuul 路由中排除或忽略特殊路径或路由
How to exclude or ignore special paths or routes from zuul routing
是否可以从 Zuul 路由中排除路径或匹配器?
目标是
- 对 /contracts/** 的所有请求都被路由到 contract.example.com
- 对 /audit/** 的所有请求都路由到 audit.example.com
- 所有对 /heartbeat/** 或 /sso/** 的请求都由 zuul 直接提供。
- 所有其他请求 (/**) 被路由到 html.example.com
我有这样的配置:
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
是否可以从 Zuul 路由中排除路径或匹配器?
目标是
- 对 /contracts/** 的所有请求都被路由到 contract.example.com
- 对 /audit/** 的所有请求都路由到 audit.example.com
- 所有对 /heartbeat/** 或 /sso/** 的请求都由 zuul 直接提供。
- 所有其他请求 (/**) 被路由到 html.example.com
我有这样的配置:
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