diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/listeners/filters/JwtFilterFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/listeners/filters/JwtFilterFactory.kt index b5ee3bce7..666aa7b6c 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/listeners/filters/JwtFilterFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/listeners/filters/JwtFilterFactory.kt @@ -132,17 +132,21 @@ class JwtFilterFactory( methods: Set, providers: MutableSet ): RequirementRule { - val pathMatching = RouteMatch.newBuilder().setPathMatchPolicy( - TypedExtensionConfig.newBuilder() - .setName("envoy.path.match.uri_template.uri_template_matcher") - .setTypedConfig( - Any.pack( - UriTemplateMatchConfig.newBuilder() - .setPathTemplate(pathGlobPattern) - .build() - ) - ).build() - ) + + val pathMatching = + if (pathGlobPattern.matches(Regex("^[^*]*[^*/]\\*$"))) + RouteMatch.newBuilder().setPrefix(pathGlobPattern) + else RouteMatch.newBuilder().setPathMatchPolicy( + TypedExtensionConfig.newBuilder() + .setName("envoy.path.match.uri_template.uri_template_matcher") + .setTypedConfig( + Any.pack( + UriTemplateMatchConfig.newBuilder() + .setPathTemplate(pathGlobPattern) + .build() + ) + ).build() + ) if (methods.isNotEmpty()) { pathMatching.addHeaders(createHeaderMatcherBuilder(methods)) }