Nginx ssl https

Hello,

I'm new to the topics and I'm trying to expose a metabase docker hosted on de VM to a dedicated <final_url> though HTTPS.

I didn't succeded using the jetty server, even after convertig the keys :exploding_head: so I'm trying with nginx.

I succeded to have my <final_url> though HTTPS working but metabase is still accessible from the < VM-IP >:3000 over HTTP. I think it's a problem. Can someone comfim and tell me how to avoid that ?

Thank you,

I spend hours to make it work so I share the used commande in case it can help someone:

sudo apt install snapd

sudo snap install --classic certbot

sudo ln -s /snap/bin/certbot /usr/bin/certbot

sudo certbot certonly --standalone --preferred-challenges http -d <final_url>

docker network create proxy-network

CREATE conf.d/metabase.conf file  with the following lines

server {
listen 80;
server_name <final_url>; location / {
     return 301 https://$host$request_uri;
}
}server {
listen 443 ssl;
server_name <final_url>;
ssl_certificate /etc/letsencrypt/live/<final_url>/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/<final_url>/privkey.pem;
location / {
        proxy_pass http://metabase:3000;
        proxy_set_header      Host $host;
        proxy_set_header      X-Real-IP $remote_addr;
        proxy_set_header      X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header Accept-Encoding "gzip";
        proxy_connect_timeout       60;
        proxy_send_timeout          60;
        proxy_read_timeout          60;
        send_timeout                60;
}
}

docker run -d -p 3000:3000 --name metabase -v DataShared:/shareddata metabase/metabase

docker run -d --restart always -p 80:80 -p 443:443 \
-v /home/debian/conf.d:/etc/nginx/conf.d \
-v /etc/letsencrypt/live/<final_url>/fullchain.pem:/etc/letsencrypt/live/<final_url>/fullchain.pem \
-v /etc/letsencrypt/live/<final_url>/privkey.pem:/etc/letsencrypt/live/<final_url>/privkey.pem \
--network proxy-network --name nginx-proxy nginx



docker network connect proxy-network metabase    


try an example like GitHub - paoliniluis/metabase-ha: Metabase with high availability

Thank you for your response @Luiggi

I finally managed to make it works with my code. It worked for days but this morning I have an ERR_TOO_MANY_REDIRECTS error when I go on the <final_url> from my browser.

On the Nginx docker I can see a 301 error is raised for all address. So the server is currently down.

Any ideas how to solve that ?

Everything works now, a user clicked "Https" mode in the admin panel which break the connection