<p>I'm trying to make a simple example of ingress-nginx on google cloud, but it's not matching the subpaths:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test-ingress
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
    - http:
        paths:
        - path: /one
          backend:
            serviceName: test-one-backend
            servicePort: 80
        - path: /two
          backend:
            serviceName: test-two-backend
            servicePort: 80
</code></pre>

<p>When I call, <a href="http://server/one" rel="nofollow noreferrer">http://server/one</a> works, but when I call  <a href="http://server/one/path" rel="nofollow noreferrer">http://server/one/path</a> I get a 404.
I'd tried several things like using regex, but is simply not working</p>

<p>The backends are just, echo servers that reply always on any path.</p>

Alex M
<p>Attention it changed in version 0.22.0 of ingress-nginx. checkout example at <a href="https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md" rel="nofollow noreferrer">https://github.com/kubernetes/ingress-nginx/blob/master/docs/examples/rewrite/README.md</a>
Now you have to work with captured groups to pass a subpath to the rewrite-target.</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$2
  name: rewrite
  namespace: default
spec:
  rules:
  - host: rewrite.bar.com
    http:
      paths:
      - backend:
          serviceName: http-svc
          servicePort: 80
        path: /something(/|$)(.*)
</code></pre>
