I have a kibana running inside docker container in k8s. And I put a nginx as sidecar to forward all traffic to kibana based on path.
Below is my nginx configuration. It works fine for elasticsearch. But when I open /kibana/ in browser, it redirects to /spaces/enter and shows 404 Not Found.
In kibana container log I can see a 302 forward log:
{"type":"response","@timestamp":"2021-02-24T05:50:32Z","tags":[],"pid":7,"method":"get","statusCode":302,"req":{"url":"/","method":"get","headers":{"connection":"Keep-Alive","proxy-connection":"Keep-Alive","host":"kibana-entrypoint:5601","x-forwarded-for":"49.255.115.150","x-forwarded-proto":"http","x-forwarded-port":"80","x-amzn-trace-id":"Root=1-6035e928-603d67da7eff4225005fdbfc","upgrade-insecure-requests":"1","user-agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36","accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9","accept-encoding":"gzip, deflate","accept-language":"en-GB,en-US;q=0.9,en;q=0.8"},"remoteAddress":"192.168.1.41","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 11_1_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"},"res":{"statusCode":302,"responseTime":7,"contentLength":9},"message":"GET / 302 7ms - 9.0B"}
user nginx;
worker_processes 1;
events {
worker_connections 10240;
}
http {
server {
listen 8080;
server_name localhost;
location /es/ {
proxy_pass http://sample-es-entrypoint:9200/;
}
location /health {
proxy_pass http://sample-es-entrypoint:9200/_cluster/health;
}
location /kibana/ {
proxy_pass http://kibana-entrypoint:5601/;
proxy_redirect off;
proxy_buffering off;
proxy_http_version 1.1;
proxy_set_header Connection "Keep-Alive";
proxy_set_header Proxy-Connection "Keep-Alive";
}
}
}
The question is why kibana forward the request?