<p>I would to build following an service deployed to kubernetes to be accessed using an ingress object.</p>

<p>I would like to use <a href="https://mylocation.com/myprogram/doc" rel="nofollow noreferrer">https://mylocation.com/myprogram/doc</a> to access the app but only <a href="https://mylocation.com/myprogram/doc/" rel="nofollow noreferrer">https://mylocation.com/myprogram/doc/</a> works.</p>

<p>I have created the following entry in my yaml</p>

<pre><code># -----------------
# Ingress object
# -----------------
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myapp-ingress
  namespace: documentation
  annotations:
    kubernetes.io/ingress.class: nginx
    #Default is 'true'
spec:
  tls:
  - hosts:
    - mylocation.com
  rules:
  - host: mylocation.com
    http:
      paths:
      - backend:
          serviceName: myapp-service
          servicePort: 80
        path: /myapp/doc
      - backend:
          serviceName: myapp-service
          servicePort: 80
        path: /myapp/doc/(.*)


</code></pre>

<p>I have created the ingress object kubectl apply -f filename</p>

<p>When I browse <a href="http://mylocation.com//myapp/doc" rel="nofollow noreferrer">http://mylocation.com//myapp/doc</a>, I get HTTP ERROR 404
When I browse <a href="http://mylocation.com//myapp/doc/" rel="nofollow noreferrer">http://mylocation.com//myapp/doc/</a>, It works</p>

<p>Can someone help me to get <a href="http://mylocation.com//myapp/doc" rel="nofollow noreferrer">http://mylocation.com//myapp/doc</a> working?</p>

<p>Thanks for your help.</p>

Seb HO
<p>Make sure to place appropriate regex</p>

<pre><code># -----------------
# Ingress object
# -----------------
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: myapp-ingress
  namespace: documentation
  annotations:
    kubernetes.io/ingress.class: nginx
    #Default is 'true'
spec:
  tls:
  - hosts:
    - mylocation.com
  rules:
  - host: mylocation.com
    http:
      paths:
      - backend:
          serviceName: myapp-service
          servicePort: 80
        path: /myapp/doc(/|$)(.*)
`
</code></pre>
