Skip to content

Commit 7f1292d

Browse files
committed
Route API requests on exact URL matches, not prefix matches
(cherry picked from commit bb22971)
1 parent 0d64cd6 commit 7f1292d

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

pkg/lib/k8s/virtual_service.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func VirtualService(spec *VirtualServiceSpec) *kunstructured.Unstructured {
7474
"match": []map[string]interface{}{
7575
{
7676
"uri": map[string]interface{}{
77-
"prefix": urls.CanonicalizeEndpoint(spec.Path),
77+
"exact": urls.CanonicalizeEndpoint(spec.Path),
7878
},
7979
},
8080
},
@@ -279,16 +279,16 @@ func GetVirtualServiceEndpoints(virtualService *kunstructured.Unstructured) (str
279279
return nil, errors.New("uri is not a map[string]interface{}") // unexpected
280280
}
281281

282-
prefixInferface, ok := uri["prefix"]
282+
exactInferface, ok := uri["exact"]
283283
if !ok {
284284
return strset.New("/"), nil
285285
}
286-
prefix, ok := prefixInferface.(string)
286+
exact, ok := exactInferface.(string)
287287
if !ok {
288-
return nil, errors.New("prefix is not a string") // unexpected
288+
return nil, errors.New("url is not a string") // unexpected
289289
}
290290

291-
endpoints.Add(urls.CanonicalizeEndpoint(prefix))
291+
endpoints.Add(urls.CanonicalizeEndpoint(exact))
292292
}
293293
}
294294

0 commit comments

Comments
 (0)