From bd8c3cc736d310aed7a1dad604015e75b4becd6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=AD=E4=BB=98=E4=B8=80=E7=94=B7?= Date: Tue, 22 Apr 2025 22:34:49 +0800 Subject: [PATCH] docs: explain spring.webflux.base-path influence on Path Route Predicate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 郭付一男 --- .../spring-cloud-gateway/request-predicates-factories.adoc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/modules/ROOT/pages/spring-cloud-gateway/request-predicates-factories.adoc b/docs/modules/ROOT/pages/spring-cloud-gateway/request-predicates-factories.adoc index 93a1e10e..c1cb13ee 100644 --- a/docs/modules/ROOT/pages/spring-cloud-gateway/request-predicates-factories.adoc +++ b/docs/modules/ROOT/pages/spring-cloud-gateway/request-predicates-factories.adoc @@ -192,6 +192,8 @@ This route matches if the request path was, for example: `/red/1` or `/red/1/` o If `matchTrailingSlash` is set to `false`, then request path `/red/1/` will not be matched. +If you have set `spring.webflux.base-path` property, this will influence the path matching. The property value will be automatically prepended to the path patterns. For example, with `spring.webflux.base-path=/app` and a path pattern of `/red/{segment}`, the full pattern used for matching would be `/app/red/{segment}`. + This predicate extracts the URI template variables (such as `segment`, defined in the preceding example) as a map of names and values and places it in the `ServerWebExchange.getAttributes()` with a key defined in `ServerWebExchangeUtils.URI_TEMPLATE_VARIABLES_ATTRIBUTE`. Those values are then available for use by <>