URL Rewrite
Overview
The URL Rewrite Traffic Policy action enables you to modify the incoming request URL using regular expressions before it reaches the upstream server, without changing the URL seen by the client.
This action is useful for routing users without exposing internal system details.
Configuration Reference
This is the Traffic Policy configuration reference for this action.
Action Type
url-rewrite
Configuration Fields
Parameter | Type | Description |
---|---|---|
from | string | Required. A regular expression string to match inside of the URL. Supports CEL Interpolation. |
to | string | Required. A regular expression string to replace the from match with. Supports CEL Interpolation. |
format | string | Determines interpolation format in to /from fields. Default ngrok . |
Supported Phases
on_http_request
Supported Schemes
https
http
Behavior
This action replaces all matches of thefrom
regular expression in the request
URL with theto
replacement value.
Matching
Matching is done against the full URL, including the scheme, userinfo, host, and port, not just the path.
To match requests that start with /products
you must use
CEL Interpolation and write
^${req.url.authority}/products
or use an expression like
req.url.path.startsWith('/products')
in the policy rule expressions
field.