server {
  listen   80; ## listen for ipv4; this line is default and implied
  listen   [::]:80 default ipv6only=on; ## listen for ipv6

  # Make site accessible from http://localhost/
  server_name localhost;

  location = /health {
    return 200;
    access_log off;
  }

  location / {
    proxy_pass http://kibana:5601;
    proxy_read_timeout 90;

    if ($http_x_forwarded_proto != "https") {
      rewrite ^ https://$host$uri permanent;
    }

    auth_basic "Restricted";
    auth_basic_user_file /etc/kibana/htpasswd;
  }
}
