<p>I want exposing various services with a single ingress.</p>

<pre><code>rules:
  - http:
      paths:
      # The path is the URL prefix for the service, e.g. /api/* or just /*
      # Note that the service will receive the entire URL with the prefix
      - path: /service1/*
        backend:
          serviceName: service1
          servicePort: 5000
      - path: /service2/*
        backend:
          serviceName: service2
          servicePort: 5000
</code></pre>

<p>The problem is the whole URL including the prefix is passed to the underlying services so all requests return 404 errors: <code>service1</code> and api don't respond on <code>/service1/some/path</code> but directly on <code>/some/path</code></p>

<p>How can I specify a prefix to the underlying services?</p>

<p><strong>UPDATE</strong></p>

<p>I tried using rewrite-target as follows. Requests are sent to the <code>rasa-nlu</code> service, but they all trigger 404 because <code>rasa-nlu</code> still gets the <code>/nlu</code> </p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: ingress
  annotations:
    ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - http:
      paths:
      - path: /nlu
        backend:
          serviceName: rasa-nlu
          servicePort: 5000
</code></pre>

<p>This might be what you are looking for;</p>

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

<p>Note the <strong>annotation</strong> to rewrite-target. </p>

<p>Found this <a href="https://github.com/kubernetes/contrib/tree/master/ingress/controllers/nginx/examples/rewrite" rel="noreferrer">here</a></p>
