Request Transformer Advanced

Replace the URI using capturing groups

Configure the plugin to replace the request URI using a capture group in the original URI before proxying the request to the upstream server.

Prerequisites

  • You have configure a route with the path ~/(?<status>\d+)

Set up the plugin

Make the following request:

curl -i -X POST http://localhost:8001/plugins/ \
    --header "Accept: application/json" \
    --header "Content-Type: application/json" \
    --data '
    {
      "name": "request-transformer-advanced",
      "config": {
        "replace": {
          "uri": "/status/\\$(uri_captures[\"status\"])"
        }
      }
    }
    '
Copied to clipboard!

Did this doc help?

Something wrong?

Help us make these docs great!

Kong Developer docs are open source. If you find these useful and want to make them better, contribute today!