<p>I have an Elastic stack with <code>elasticsearch</code> and <code>kibana</code> version <code>7.10.0</code> using <code>elk</code> operator in kubernetes</p>
<p>Whenever I enter the link <a href="https://monitoring.cloudapp.azure.com/kibana" rel="nofollow noreferrer">https://monitoring.cloudapp.azure.com/kibana</a> I'm getting this redirection:</p>
<pre><code>https://monitoring.cloudapp.azure.com/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%252Fkibana%252Fkibana%
</code></pre>
<p>In the <code>Pod</code> logs:</p>
<pre><code>&quot;type&quot;:&quot;response&quot;,&quot;@timestamp&quot;:&quot;2020-12-23T15:38:27Z&quot;,&quot;tags&quot;:,&quot;pid&quot;:7,&quot;method&quot;:&quot;get&quot;,&quot;statusCode&quot;:302,&quot;req&quot;:{&quot;url&quot;:&quot;/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%3D%252Fkibana%252.....
</code></pre>
<p><code>Kibana.yaml</code></p>
<pre><code>apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: kibana
spec:
  version: 7.10.0
  count: 1
  elasticsearchRef:
    name: elastic-https
  http:
    service:
      spec:
        type: ClusterIP
    tls:
      selfSignedCertificate:
        disabled: true
  podTemplate:
    spec:
      containers:
      - name: kibana
        env:
        - name: SERVER_BASEPATH
          value: &quot;/kibana&quot;
        resources:
          requests:
            memory: 4Gi
            cpu: 1
          limits:
            memory: 8Gi
            cpu: 2
    metadata:
      annotations:
        sidecar.istio.io/rewriteAppHTTPProbers: &quot;true&quot;
</code></pre>
<p><code>kibana.ingress.yaml</code></p>
<pre><code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    kubernetes.io/ingress.class: istio
  name: kibana-ingress
spec:
  rules:
    - host: &quot;monitoring.cloudapp.azure.com&quot;
      http:
        paths:
          - path: /kibana/login.*
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601
          - path: /kibana
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601
          - path: /kibana/*
            backend:
              serviceName: kibana-kb-http
              servicePort: 5601
</code></pre>
<p>No way with incognito window, I have the same problem whenever I do a <code>kubectl port-forward</code> I stumble upon the same problem with the redirection (with <code>HTTP</code>)</p>
<pre><code>&gt; http://localhost:52000/kibana/login?next=%2Fkibana%2Fkibana%2Flogin%3Fnext%
</code></pre>

Inforedaster
<p>The solution is to add server.rewriteBasePath: true  like this</p>
<pre><code>---
apiVersion: kibana.k8s.elastic.co/v1
kind: Kibana
metadata:
  name: kibana
spec:
  config:
    server.rewriteBasePath: true
</code></pre>
<p>and update the readinessProbe like :</p>
<pre><code> podTemplate:
    spec:
      containers:
      - name: kibana
        readinessProbe:
          httpGet:
            scheme: HTTP
            path: /kibana
            port: 5601
        env:
        - name: SERVER_BASEPATH
          value: &quot;/kibana&quot;
</code></pre>
<p>don't forget with more than 1 replica set the redirect from / kibana to /kibana/login doesn't works</p>
