title: Kubernetes Ingress path based routing not working as expected
body: <p>I installed <a href="https://github.com/nginxinc/kubernetes-ingress" rel="nofollow noreferrer">NGINX Ingress</a> in kubernetes cluster. When i am trying to access the micro service end via Ingress Controller its not working as expected</p>
  
  <p>I have deployed two spring boot application</p>
  
  <p><strong>Ingress  Rules</strong><br /></p>
  
  <ul>
  <li>Path 1 -> /customer <br /> </li>
  <li>Path 2 -> /prac <br /></li>
  </ul>
  
  <p>When i am trying to access one of the service  ex. 
  <strong><a href="http://test.practice.com/prac/practice/getprac" rel="nofollow noreferrer">http://test.practice.com/prac/practice/getprac</a></strong> , it does not work  <br /></p>
  
  <p><a href="https://i.stack.imgur.com/tJURc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tJURc.png" alt="enter image description here"></a></p>
  
  <p>but when i try to access without Ingress path <strong><a href="http://test.practice.com/practice/getprac" rel="nofollow noreferrer">http://test.practice.com/practice/getprac</a></strong>, it works</p>
  
  <p><a href="https://i.stack.imgur.com/eOwlX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eOwlX.png" alt="enter image description here"></a></p>
  
  <p>I am not able to understand why with Ingress path its not working and same happens for other service</p>
  
  <p>Micro service 1 (Port 9090)</p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: customer
    namespace: practice
    labels: 
      app: customer
  spec:
    replicas: 5
    selector:
      matchLabels: 
        app: customer
    template: 
      metadata:
        labels: 
          app: customer
      spec: 
        imagePullSecrets:
        - name: testkuldeepsecret
        containers:
        - name: customer
          image: kuldeep99/customer:v1
          ports:
          - containerPort: 9090
            hostPort: 9090
  
  ---
  apiVersion: v1
  kind: Service
  metadata:                     
    name: customer-service
    namespace: practice
    labels: 
  spec:                         
    ports: 
    - port: 9090 
      targetPort: 9090
      protocol: TCP
      name: http
    selector:
      app: customer
  </code></pre>
  
  <p>Micro service 2 (port 8000)</p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: prac
    namespace: practice
    labels: 
      app: prac
  spec:
    replicas: 4
    selector:
      matchLabels: 
        app: prac
    template: 
      metadata:
        labels: 
          app: prac
      spec: 
        imagePullSecrets:
        - name: testkuldeepsecret
        containers:
        - name: prac
          image: kuldeep99/practice:v1
          ports:
          - containerPort: 8000
            hostPort: 8000
  
  ---
  apiVersion: v1
  kind: Service
  metadata:                     
    name: prac-service
    namespace: practice
    labels: 
  spec:                         
    ports: 
    - port: 8000 
      targetPort: 8000
      protocol: TCP
      name: http
    selector:
      app: prac
  </code></pre>
  
  <p>Service (customer-service and prac-service)</p>
  
  <pre><code>NAME               TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
  customer-service   ClusterIP   10.97.203.19    &lt;none&gt;        9090/TCP   39m
  ngtest             ClusterIP   10.98.74.149    &lt;none&gt;        80/TCP     21h
  prac-service       ClusterIP   10.96.164.210   &lt;none&gt;        8000/TCP   15m
  some-mysql         ClusterIP   None            &lt;none&gt;        3306/TCP   2d16h
  
  </code></pre>
  
  <p>Ingress </p>
  
  <pre><code>apiVersion: extensions/v1beta1
  kind: Ingress
  metadata:
    name: practice-ingress
    namespace: practice
    annotations:
      nginx.ingress.kubernetes.io/rewrite-target: /
  spec: 
    rules:
    - host: practice.example.com
      http: 
        paths:
        - backend:
            serviceName: customer-service
            servicePort: 9090
          path: /customer
        - backend:
            serviceName: prac-service
            servicePort: 8000
          path: /prac
  </code></pre>