<pre><code>paths:
  - backend:
      serviceName: booknotes-front-end-service
      servicePort: 80
    path: /
  - backend:
      serviceName: booknotes-back-end-service
      servicePort: 3000
    path: /api
</code></pre>

<p>Here is a rules in my ingres-nginx resource . I try to direct all traffic which starts from <code>/api</code> to my back end service, which works properly, but if some route in my back end will be like /api/users it doesn't work , my back end send response not found , when I run it locally this route working properly. Also I've tried delete /api prefix from my koa routing and change it to <code>/users</code> and then I've also changed  <code>path: /api</code> to <code>path: /users</code> and this stuff are working properly. What should I do for fixing it ? If you need additional info , pls let me know !</p>

Andrey Radkevich
<p>Which version of nginx-ingress are you using?
They changed the way for defining a path.</p>

<p><a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="noreferrer">https://kubernetes.github.io/ingress-nginx/examples/rewrite/</a></p>

<blockquote>
  <p>Starting in Version 0.22.0, ingress definitions using the annotation nginx.ingress.kubernetes.io/rewrite-target are not backwards compatible with previous versions. In Version 0.22.0 and beyond, any substrings within the request URI that need to be passed to the rewritten path must explicitly be defined in a capture group.</p>
</blockquote>

<p>For example you can use a definition like this.</p>

<pre><code>kind: Ingress
metadata:
  name: some-ingress-name
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
    - http:
        paths:
        - path: /?(.*)
          backend:
            serviceName: booknotes-front-end-service
            servicePort: 80
        - path: /api/?(.*)
          backend:
            serviceName: booknotes-back-end-service
            servicePort: 3000

</code></pre>
