title: Problem Sub Path Ingress Controller for Backend Service
body: <p>I have problem setting path ingress controller for backend service. For example i want setup :</p>
  
  <ol>
  <li>frontend app with angular (Path :/)  </li>
  <li>backend service with NodeJs (Path :/webservice).</li>
  </ol>
  
  <p><strong>NodeJS : Index.js</strong></p>
  
  <pre><code>const express = require('express')
  const app = express()
  const port = 4000
  
  app.get('/', (req, res) =&gt; res.send('Welcome to myApp!'))
  
  app.use('/data/office', require('./roffice'));
  app.listen(port, () =&gt; console.log(`Example app listening on port ${port}!`))
  </code></pre>
  
  <p><strong>Another Route:roffice.js</strong></p>
  
  <pre><code>var express = require('express')
  var router = express.Router()
  
  router.get('/getOffice', async function (req, res) {
     res.send('Get Data Office')
  }); 
  
  module.exports = router
  </code></pre>
  
  <p><strong>Deployment.yaml</strong></p>
  
  <pre><code>apiVersion: apps/v1
  kind: Deployment
  metadata:
    name: ws-stack
  spec:
    selector:
     matchLabels:
       run: ws-stack
    replicas: 2
    template:
      metadata:
        labels:
        run: ws-stack
    spec:
       containers:
       - name: ws-stack
         image: wsstack/node/img
         imagePullPolicy: IfNotPresent
         ports:
           - containerPort: 4000
  </code></pre>
  
  <p><strong>Service.yaml</strong></p>
  
  <pre><code>apiVersion: v1
  kind: Service
  metadata:
    name: service-wsstack
     labels:
      run: service-wsstack
    spec:
     type: NodePort
     ports:
     - port: 80
       protocol: TCP
       nodePort: 30009
       targetPort: 4000
     selector:
       run: ws-stack
  </code></pre>
  
  <p><strong>ingress.yaml</strong></p>
  
  <pre><code> apiVersion: networking.k8s.io/v1beta1
   kind: Ingress
   metadata:
     name: stack-ingress
     annotations:
       nginx.ingress.kubernetes.io/rewrite-target: /
       nginx.ingress.kubernetes.io/use-regex: "true"
    spec:
     rules:
      - host: hello-world.info
      - http:
          paths:
          - path: /
            backend:
              serviceName: service-ngstack --&gt; frondend
              servicePort: 80
          - path: /webservice
            backend:
              serviceName: service-wsstack --&gt; backend
              servicePort: 80
  </code></pre>
  
  <p>i setup deployment, service and ingress successfully. but when i called with curl</p>
  
  <pre><code>curl http://&lt;minikubeip&gt;/webservice  --&gt; Welcome to myApp! =&gt; Correct
  curl http://&lt;minikubeip&gt;/webservice/data/office/getOffice --&gt; Welcome to myApp! =&gt; Not correct
  </code></pre>
  
  <p>if i called another route, the result is the same 'Welcome to myApp'. But if i used Nodeport </p>
  
  <pre><code>curl http://&lt;minikubeip&gt;:30009/data/office/getOffice =&gt; 'Get Data Office', working properly.
  </code></pre>
  
  <p>What is the problem? any solution? Thank you</p>