<p>As I will have no wifi tomorrow this is more some kind of theory crafting. I need to prepare the ingress files in "offline mode". </p>

<p>I want to route from <code>ApplicationA</code> to <code>ApplicationB</code>. These routes are hopefully able to carry url parameter. Both applications are using <code>spring boot</code> and <code>REST</code>. The cluster is (currently) set up by <code>minikube</code>.</p>

<p>So e.g. I got this url in <code>ServiceA</code>: <code>http://url.com/customerapi/getCustomerById?id=5</code>. This url should hit a method which is defined in <code>ApplicationB</code>. <code>ApplicationB</code> is reachable using <code>customerservice</code> and port 31001.</p>

<p>Is it as simple as the ingress below? Thats pretty much straight forward. Best regards.</p>

<p>I would define an <code>kubernetes ingress</code> like this:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: serviceA
spec:
  rules:
  - http:
      paths:
      - path: /customerapi
        backend:
          serviceName: customerservice
          servicePort: 31001
</code></pre>

<p>If I understand you correctly, you want to route traffic coming from web into two backends based on the url.</p>

<p>You can set your Ingress the following way:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: cafe-ingress-nginx
  annotations:
    kubernetes.io/ingress.class: "nginx"
spec:
  rules:
  - host: url.com
    http:
      paths:
      - path: /test1
        backend:
          serviceName: test1-svc
          servicePort: 80
      - path: /test2
        backend:
          serviceName: test2-svc
          servicePort: 80
</code></pre>

<p>This will route all from <code>url.com/test1</code> to backend <code>test1-svc</code> and all from <code>url.com/test2</code> to backend <code>test2-svc</code>.</p>

<p>If you need to use the parameter inside the <code>Url</code>, I think the following will work:</p>

<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: test
  annotations:
    ingress.kubernetes.io/query-routing: default/query-routing
spec:
  backend:
    serviceName: default-backend
    servicePort: 80
  rules:
  - host: url.com

---

kind:ConfigMap
apiVersion: v1
metadata:
  name: query-routing
data:
  mapping: |-
    [{
      "field": "getCustomerById",
      "value": "1",
      "path": "customerapi/",
      "service": "customerservice",
      "port": "31001"
    }]
</code></pre>

<p>But please test it on your example, as there are not enough details in your question.</p>

<p>There is  a way of catching the parameter from <code>Header</code>  using <code>nginx.ingress.kubernetes.io/server-snippet</code> Annotations. This particular one is being used by Shopify and usage is explained <a href="https://github.com/Shopify/ingress/blob/master/docs/user-guide/nginx-configuration/annotations.md#server-snippet" rel="nofollow noreferrer">here</a>. For more annotations please check Kubernetes <a href="https://kubernetes.github.io/ingress-nginx/user-guide/nginx-configuration/annotations/" rel="nofollow noreferrer">NGINX Ingress Controller</a>.</p>
