Open Source API Gateway

path

Version

Selects the requests an API handles by their path. A plain path matches every request path that starts with it. In an api, the path can also be a URI template such as /books/{id}; the parameter values are available as pathParam, e.g. ${pathParam.id} in the target URL.

See tutorials/getting-started/60-Basic-Path-Routing.yaml and tutorials/advanced/20-Path-Parameter-Routing.yaml.

Security Hint

A regular expression runs on every request before authentication. Overlapping quantifiers such as (.*)/(.*) can take a long time on crafted paths. See ReDoS Protection.

Example Configuration

api:
port: 2000
path:
uri: /shop
target:
url: https://api.predic8.de
---
api:
port: 2000
path:
uri: /fruits/{id}
target:
url: https://api.predic8.de/shop/v2/products/${pathParam.id}
api:
   port: 2000
   path:
     uri: /shop
   target:
     url: https://api.predic8.de
 ---
 api:
   port: 2000
   path:
     uri: /fruits/{id}
   target:
     url: https://api.predic8.de/shop/v2/products/${pathParam.id}

Syntax

path:
isRegExp: <boolean>
uri: <string>
path:
  isRegExp: <boolean>
  uri: <string>

Attributes

NameRequiredDefaultDescriptionExamples
isRegExpfalsefalse

If true, uri is a Java regular expression that must match the whole path. In an api, the query is ignored and {name} parameters can be used; in a serviceProxy, the expression must also match the query. Not supported in a soapProxy.

true
urifalse---

Can be used in