<p>We have deployed Traefik 2.2 on our Kubernetes cluster with following ingress-route created to access our application. This configuration is working fine for us and is currently the same for our Production system as well.</p>

<pre class="lang-yaml prettyprint-override"><code>apiVersion: traefik.containo.us/v1alpha1
kind: IngressRoute
metadata:
  name: application-xyz

spec:
  tls: {}
  entryPoints:
    - web
    - websecure
  routes:

    - match: "HostRegexp(`application-xyz.com`) &amp;&amp; PathPrefix(`/`)"

      kind: Rule
      priority: 1
      services:
        - name: application-xyz-service
          port: 80


    - match: "PathPrefix(`/application-xyz/`)"
      kind: Rule
      services:
        - name: application-xyz-service
          port: 80
      middlewares:
        - name: application-xyz-stripprefix
---
apiVersion: traefik.containo.us/v1alpha1
kind: Middleware
metadata:
  name: application-xyz-stripprefix
  namespace: frontend
spec:
  stripPrefix:
    prefixes:
      - /application-xyz/
    forceSlash: false
</code></pre>

<p>Question 1:
We are now planning to migrate from Traefik to Nginx Ingress Controller. Is there any way we can replicate the same on Nginx similar to Traefik configuration. I'm unsure if I'm comparing this in the right way or not. Would be grateful if we can get any pointers.</p>

<p>Question 2:
We wish to achieve stripprefix functionality in Nginx but didn't find any helpful documentation. Any leads in this regard is highly appreciated.</p>

<p>StripPrefix functionality in nginx ingress you can achieve using <a href="https://kubernetes.github.io/ingress-nginx/examples/rewrite/" rel="nofollow noreferrer"><code>rewrite-target</code> annotation</a>.
When <code>rewrite-target</code> is used, regexp path matching is enabled and it allows you to match eny part of path into groups and rewrite path based on that.</p>

<p>In your case it would look like following:</p>

<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /$1
  name: rewrite
  namespace: default
spec:
  rules:
  - host: application-xyz.com
    http:
      paths:
      - backend:
          serviceName: application-xyz-service
          servicePort: 80
        path: /(.*)
  - http:
      paths:
      - backend:
          serviceName: application-xyz-service
          servicePort: 80
        path: /application-xyz/(.*)
</code></pre>

<p>Feel free to ask questions if you feel like my answer needs more detailed explaination.</p>
