url-rewrite
Changes the path and query your service receives, without the visitor seeing a redirect.
| Phases | on_http_request |
| Terminating | No — the next action runs after it. |
| Cost | 10 Traffic Policy units per run · not on the Free plan |
Example
policy.yaml
on_http_request:
- name: VersionedApi
actions:
- type: url-rewrite
config:
from: "^/api/v1/(.*)"
to: "/v2/$1"
Start an agent endpoint with it: devgate http 8080 --traffic-policy-file policy.yaml, or paste it into a
reserved or cloud endpoint’s Traffic Policy tab in the dashboard.
Configuration
| Field | Type | Description |
|---|---|---|
from required | string | A regular expression matched against the path and query. |
to required | string | The replacement; capture groups as $1, $2… |
Behaviour
- The traffic log and the inspector keep the URL the visitor asked for.
- Only the path and query change; the host stays the same.
Other actions
add-headers remove-headers compress-response basic-auth oauth openid-connect jwt-validation custom-response deny redirect restrict-ips rate-limit circuit-breaker verify-webhook http-request set-vars log close-connection forward-internal