Kong Ingress Controller provides the
konghq.com/rewrite annotation to customize the request path before it is sent to the upstream service.
The annotation can be used on
HTTPRoute resources, and configures a request-transformer plugin within Kong when added to a route.
This definition creates a route that matches the path
/users/(\w+) and rewrites it to
/requests/users_svc/$1 before sending the request upstream.
Alternatively, you can define this in a plugin configuration.
- name: request-transformer
$1 in the annotation is expanded to
$(uri_captures) in the plugin configuration.
Up to nine capture groups are supported using the
konghq.com/rewrite annotation. If you need more than 9 capture groups, create a KongPlugin resource to handle the transformation.