Reverse proxy by using nginx

Kibana supports basic authentification (See elasticsearch 7.4).
That is, we can use basic access authentication (See wikipedia for details)
Then, reverse proxy can be good solution for this issue. Here is sample configuration of Nginx for this purpose.


docker-composer.yml

version: '3'

services:
  reverseProxy:
    container_name: reverseProxy
    hostname: reverseProxy
    image: nginx
    ports:
      - 5601:5601
    volumes:
      - ./nginx:/etc/nginx

*nginx.conf*
events {
}

http {
upstream kibana {
server KIBANA.IP.ADDR.NUM:5601;
}

server {
listen 5601;
server_name reverse.kibana.com;

location / {
  proxy_pass        http://kibana;
  proxy_set_header  X-Real-IP           $remote_addr;
  proxy_set_header  X-Forwarded-For     $proxy_add_x_forwarded_for;
  proxy_set_header  X-Forwarded-Proto   $scheme;
  proxy_set_header  Host                $host;
  proxy_set_header  X-Forwarded-Host    $host;
  proxy_set_header  X-Forwarded-Port    $server_port;
  # ID:PW base64 encoded value (RFC 7617)
  proxy_set_header  Authorization       "Basic QWxhZGRpbjpPcGVuU2VzYW1l";
}

}
}

+ Recent posts