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
| Name | Required | Default | Description | Examples |
|---|---|---|---|---|
| isRegExp | false | false | If true, | true |
| uri | false | - | - | - |