<p>I'm using azure k8's at the moment. I have two services which i need to expose via same domain and wanted add paths for different service.</p>
<p>ingress files as follows</p>
<pre><code>
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: kibana-ingress
  namespace : {{ .Values.namespace }}
  annotations:
    kubernetes.io/ingress.class: &quot;nginx&quot;
    nginx.ingress.kubernetes.io/affinity: &quot;cookie&quot;
    nginx.ingress.kubernetes.io/session-cookie-name: &quot;route&quot;
    nginx.ingress.kubernetes.io/session-cookie-hash: &quot;sha1&quot;
    nginx.ingress.kubernetes.io/rewrite-target: /$2
    nginx.ingress.kubernetes.io/use-regex: &quot;true&quot;
spec:
  tls:
  - hosts:
    - {{ .Values.kibana.ingressdomain }}
    secretName: abb-aks-cert
  rules:
  - host: {{ .Values.kibana.ingressdomain }}
    http:
      paths:
      - path: /app/kibana
        backend:
          serviceName: kibana-service
          servicePort: 5601
      - path: /grafana
        backend:
            serviceName: monitor-grafana
            servicePort: 80


</code></pre>
<p>When i define like this i'm getting 404 errors. Is there any solution for this?</p>
<p>Kubernetes version is 1.16</p>

Chinthaka Hasakelum
<p>This is very common mistake people make.
Web applications usually (by default) serve with base path = <code>/</code>.
During first request, the website resonds correctly but with incorrect paths because it not aware that its running behind proxy and that sth is rewriting the paths.</p>
<p>You need to set root/base path for both appications accordingly and remove the rewrite because its not needed.</p>
<hr />
<p>For kibana you need to set:</p>
<blockquote>
<h3>server.basePath:</h3>
<p>Enables you to specify a path to mount Kibana at if you are running behind a proxy. Use the server.rewriteBasePath setting to tell Kibana if it should remove the basePath from requests it receives, and to prevent a deprecation warning at startup. This setting cannot end in a slash (/).</p>
</blockquote>
<p>More in <a href="https://www.elastic.co/guide/en/kibana/current/settings.html" rel="nofollow noreferrer">kibana docs</a></p>
<hr />
<p>For grafana you need to set:</p>
<blockquote>
<h3>root_url</h3>
<p>This is the full URL used to access Grafana from a web browser. This is important if you use Google or GitHub OAuth authentication (for the callback URL to be correct).</p>
<blockquote>
<p>Note: This setting is also important if you have a reverse proxy in front of Grafana that exposes it through a subpath. In that case add the subpath to the end of this URL setting.</p>
</blockquote>
<h3>serve_from_sub_path</h3>
<p>Serve Grafana from subpath specified in root_url setting. By default it is set to false for compatibility reasons.</p>
<p>By enabling this setting and using a subpath in root_url above, e.g. root_url = http://localhost:3000/grafana, Grafana is accessible on http://localhost:3000/grafana</p>
</blockquote>
<p>More in <a href="https://grafana.com/docs/grafana/latest/administration/configuration/#root_url" rel="nofollow noreferrer">grafana docs</a></p>
