I noticed some behavior related to pattern matching on Apigee Edge that requires some looking into. Consider the following conditional flows in the Proxy endpoint (basepath: /examples) of a proxy as an example. The only difference is the operator being use “MatchesPath” in Flow A vs “Matches” in Flow B.
A.
JS-ExtractVariables
(proxy.pathsuffix MatchesPath “/”) and (request.verb = “GET”)
B.
JS-ExtractVariables
(proxy.pathsuffix Matches “/”) and (request.verb = “GET”)
I ran the following tests on both flows:
Flow |
URI |
Trace expression |
Trace express result |
proxy.pathsuffix |
|---|---|---|---|---|
A |
https://api-sandbox.apigee.appliedcloudservices.com/examples/ |
(proxy.pathsuffix matches / and (request.verb equals “GET”)) |
false |
/ |
A |
https://api-sandbox.apigee.appliedcloudservices.com/examples |
(proxy.pathsuffix matches / and (request.verb equals “GET”)) |
true |
|
B |
https://api-sandbox.apigee.appliedcloudservices.com/examples |
(proxy.pathsuffix matches / and (request.verb equals “GET”)) |
false |
|
B |
https://api-sandbox.apigee.appliedcloudservices.com/examples/ |
(proxy.pathsuffix matches / and (request.verb equals “GET”)) |
true |
/ |
Notice that the expression executed/displayed is the same, however, results are different. The operator “Matches” works as expected whereas “MatchesPath” returns true when proxy.pathsuffix is empty and return true when value (“/”) should match. Is there an explanation for this?