<p>I have a container running on url like <a href="http://localhost:8000/ps/app/ui/?pid=201" rel="nofollow noreferrer">http://localhost:8000/ps/app/ui/?pid=201</a>. The container is deployed on kubernetes and exposed to a service as "ps-app-ui:8000"
I want to create an ingress which can be accessible from outside. Ingress template is like:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ps-ingress
spec:
  rules:
  - http:
      paths:
      - path: /myapp/
        backend:
          serviceName: ps-app-ui
          servicePort: 8000
</code></pre>

<p>The problem is its not working with this ingress. I also tried adding "ingress.kubernetes.io/rewrite-target: /" but had no success. Can anyone help me to get my application accessible via "<a href="http://INGRESS-IP/myapp/ps/app/ui/?pid=201" rel="nofollow noreferrer">http://INGRESS-IP/myapp/ps/app/ui/?pid=201</a>"</p>

<p>Will be really grateful.</p>

<p>Ingress version 0.22.0 or higher has changed the way how rewrite-target works.
You'll need to regex-match the path and add it to the rewrite-target.</p>

<pre><code>nginx.ingress.kubernetes.io/rewrite-target: /$2
...
...
  rules:
  - host: rewrite.bar.com
    http:
      paths:
      - backend:
          serviceName: http-svc
          servicePort: 80
        path: /something(/|$)(.*)
</code></pre>

<p>Refer to changelog <a href="https://github.com/kubernetes/ingress-nginx/releases" rel="nofollow noreferrer">here</a>.
How to article <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/#rewrite-target" rel="nofollow noreferrer">here</a></p>
