Elasticsearch + Xpack + Kibana + Docker + Nginx

Hello. I am having a problem with kibana working. I have an elastic cluster of 3 nodes. For fault tolerance, I decided to install kibana in swarm-cluster with Nginx Reverse Proxy. When trying to log in, I am catching a 302 redirect loop. (ERR_TOO_MANY_REDIRECTS) How can I solve this?

Kibna config
server.host: 0.0.0.0
server.port: 5601

#Elastic node
elasticsearch.hosts:
  - https://ip:9200
  - https://ip:9200
  - https://ip:9200

#frequency query refresh node
elasticsearch.sniffInterval: 60000
elasticsearch.sniffOnConnectionFault: true

elasticsearch.ssl.certificateAuthorities: [ "/usr/share/kibana/config/cert/elasticsearch-ca.pem" ]

server.ssl.enabled: true
server.ssl.keystore.path: "/usr/share/kibana/config/cert/kibana-cert.p12"
server.ssl.truststore.path: "/usr/share/kibana/config/cert/elastic-stack-ca.p12"
Nginx config
server {
   listen 80;
   server_name domain;

    location /.well-known/acme-challenge/ {
        root /var/www/html;
    }
    location / {
         return 301 https://$server_name$request_uri;
    }
}

server {
   listen 443 ssl http2;
   server_name domain;

   ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
   ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;
   ssl_protocols TLSv1 TLSv1.1 TLSv1.2;

   location / {
       proxy_http_version 1.1;
       proxy_pass https://kibana:5601;
       proxy_set_header Upgrade $http_upgrade;
       proxy_set_header Connection 'upgrade';
       proxy_set_header Host $host;
       proxy_cache_bypass $http_upgrade;
   }
}

Welcome to our community! :smiley:

Can you elaborate more on why you implemented nginx?

We implemented nginx because we restrict access to the resource through our openvpn.