<p>I'm trying to configure NGINX Ingress controller as the correct entry point to my Kubernetes cluster. Inside the cluster, I've created two REST Web services as well as frontend application. I'm trying to achieve the following scenario.</p>
<ul>
<li>When the ingress IP is hit without any parameters it should be routed
to the frontend app. Example: <code>192.168.1.20</code> should lead to frontend
service on port 80.</li>
<li>When parameters are given, the request should be
routed to correct REST service. Example:
<code>192.168.1.20/first-rest/api/flower?id=1</code> should route the request to
the first-rest service so that it could return the flower with id =
1.</li>
</ul>
<br>
I can correctly access the frontend application but when trying to access any REST service I'm getting 404 error or no response at all. First-rest, Second-rest and frontend are running correctly and are accessible when configured as LoadBalancer services. With Nginx, they are configured as ClusterIp services. 
<br>
My ingress configuration
------------------------
<pre><code>apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
  name: main-routes
  annotations:
    kubernetes.io/ingress.class: nginx
    nginx.ingress.kubernetes.io/ssl-redirect: &quot;false&quot;
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$1
spec:
  rules:
  - http:
      paths:
      - path: /first-rest(/|$)(.*)
        backend:
          serviceName: first-rest
          servicePort: 8090
      - path: /second-rest(/|$)(.*)
        backend:
          serviceName: second-rest
          servicePort: 9000
      - path: /(.*)
        backend:
          serviceName: frontend
          servicePort: 80
</code></pre>
<br>
It seems like NGINX is cutting short my URL parameters that are required for my REST API.<br> Is there any way to pass the right URL path so that `192.168.1.20/first-rest/api/flower?id=1` would be routed to `[first-rest add and port]/api/flower?id=1` ?

<p>You need to specify the ingress path type otherwise , depending on the ingress class specific implementation it will default to either exact or prefix (I assume in your case it is defaulting to exact)</p>
<p>So, you need to do something like</p>
<pre><code>spec:
  rules:
  - http:
      paths:
      - path: /first-rest
        pathType: Prefix
        backend:
          serviceName: first-rest
          servicePort: 8090
</code></pre>
<p>see docs on ingress path <a href="https://v1-18.docs.kubernetes.io/docs/concepts/services-networking/ingress/#path-types" rel="nofollow noreferrer">here</a></p>
