Skip to content

Commit 39aa9a4

Browse files
authored
Merge pull request #4199 from won-seoop/doc-1949-discovery-locator-filter-override
GH-1949: Document that overriding discovery locator filters replaces defaults
2 parents 021abf6 + 5d5476f commit 39aa9a4

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

docs/modules/ROOT/pages/spring-cloud-gateway-server-webflux/the-discoveryclient-route-definition-locator.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,14 @@ The default filter is a rewrite path filter with the regex `/serviceId/?(?<remai
1919
This strips the service ID from the path before the request is sent downstream.
2020

2121
If you want to customize the predicates or filters used by the `DiscoveryClient` routes, set `spring.cloud.gateway.discovery.locator.predicates[x]` and `spring.cloud.gateway.discovery.locator.filters[y]`.
22-
When doing so, you need to make sure to include the default predicate and filter shown earlier, if you want to retain that functionality.
22+
23+
[IMPORTANT]
24+
====
25+
Setting `spring.cloud.gateway.discovery.locator.filters` *replaces* the entire default filter list.
26+
If you only add your own filters without re-declaring `RewritePath`, the service ID will *not* be stripped from the path and requests will fail with a `404` on the downstream service.
27+
Always include the default `RewritePath` filter when defining custom filters, as shown in the examples below.
28+
====
29+
2330
The following examples shows what this looks like in properties and yaml format:
2431

2532
.application.properties

0 commit comments

Comments
 (0)