<p>I have three services running in my backend and the Ingress routing is defined like this:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myapp-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    certmanager.k8s.io/cluster-issuer: letsencrypt-prod
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  tls:
  - hosts:
    - myapp.westeurope.cloudapp.azure.com
    secretName: acme-crt-secret
  rules:
  - host: myapp.westeurope.cloudapp.azure.com
    http:
      paths:
      - path: /
        backend:
          serviceName: myapp-mvc
          servicePort: 80
      - path: /api
        backend:
          serviceName: myapp-api
          servicePort: 80
      - path: /identity
        backend:
          serviceName: myapp-identity
          servicePort: 80
</code></pre>

<p>The problem is that <em>myapp-api</em> is already listening for requests to <code>/api/v1/myresource</code>. With the current configuration, the <em>myapp-api</em> service only serves requests to <code>myapp.westeurope.cloudapp.azure.com/api/api/v1/myresource</code> (please note the .../api/api/...). </p>

<p>Is it possible to serve requests to <code>/api</code> by the myapp-api service but rewriting these requests to <code>/</code> for the service without creating another Ingress? So, myapp-api should serve requests to <code>myapp.westeurope.cloudapp.azure.com/api/v1/myresource</code>.</p>

<p>You have two options:</p>

<p>a) Change the port of the API and have it serve / on that port.</p>

<p>b) Change your app so it will serve the API on "/v1/myresource" and give it the "api" part of the URL through the Ingress.</p>

<p>Either way, you'll have your resources at "myapp.westeurope.cloudapp.azure.com/api/v1/myresource".</p>
