Kong regex for Kong ingress service path

Hi everyone,
Needi some help on regex path in Kong ingress controller,

Nginx Ingress : /api/v(1-9)/application/health

How to add it in Kong ingress: tried with below regex

/api/?v[1-9]/application/health ?

Is this correct?

Hi @Godugu_ajay , Welcome!

The first path specified, /api/v(1-9)/application/health, appears to treat (1-9) as a literal string. Based on the second example you provided, I suspect this may be a typo.

The second path, /api/?v[1-9]/application/health, is a valid regex and will correctly match paths such as /api/v1/application/health.

However, if you are using Kong Gateway 3.x, please note that paths containing regex matches must begin with ~. Since starting a path with ~ is not valid in the standard Kubernetes Ingress definition, Kong uses a prefix to denote this via the konghq.com/regex-prefix annotation. This allows you to define regex-based paths by prefixing them with ~. For example:

/~/api/?v[1-9]/application/health

Please let me know if this helps.