diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt index d36feb317..d94f3305f 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/SnapshotProperties.kt @@ -264,6 +264,7 @@ class AuthorizationProperties { class CustomRuteProperties { var enabled = false var cluster = "custom" + var prefixRewrite = "" var path = StringMatcher() } diff --git a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/routes/CustomRoutesFactory.kt b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/routes/CustomRoutesFactory.kt index bf4bcf7f5..6858cfced 100644 --- a/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/routes/CustomRoutesFactory.kt +++ b/envoy-control-core/src/main/kotlin/pl/allegro/tech/servicemesh/envoycontrol/snapshot/resource/routes/CustomRoutesFactory.kt @@ -25,6 +25,11 @@ class CustomRoutesFactory(properties: RoutesProperties) { .setName(it.cluster) .setRoute(RouteAction.newBuilder() .setCluster(it.cluster) + .also { route -> + if (it.prefixRewrite != "") { + route.setPrefixRewrite(it.prefixRewrite) + } + } ) .setMatch(matcher) .build()