Using Ingress URL Rewrite

Page last updated:

Warning: VMware Enterprise PKS v1.7 is no longer supported because it has reached the End of General Support (EOGS) phase as defined by the Support Lifecycle Policy. To stay up to date with the latest software and security updates, upgrade to a supported version.

This topic describes how to perform URL rewrite for Kubernetes ingress resources.

About Support for URL Rewrite for Ingress Resources

Enterprise PKS with NSX-T supports ingress URL path rewrite using NSX-T v2.5.1+ and NCP v2.5.1+.

All the ingress paths will be rewritten to the provided value. If an ingress has annotation / and has path /tea, for example, the URI /tea will be rewritten to / before the request is sent to the backend service. Numbered capture groups are supported.

URL Rewrite Example

The following example shows how to implement URL rewrite.

kind: Ingress
  name: cafe-ingress
  annotations: "nsx"
    ncp/use-regex: "True"
    #/tea/cup will be rewritten to /cup before sending request to endpoint /$1
  - host:
      - path: /tea/(.*)
          serviceName: tea-svc
          servicePort: 80
      - path: /coffee/(.*)
          serviceName: coffee-svc
          servicePort: 80

Please send any feedback you have to