Broken HTTPS

Hello,

I need your help, because I installed a ssl certification with letsencrypt, Nginx, and a duckdns domain.
All is working with : https://myha.duckdns.org (from outside)

But when I try with my public IP (https://1XX.XXX.XXX.XXX), I can access to my HA and it tells me that the connection isn’t secured : This page is not secure (broken HTTPS).
Could you explain me how to creat a redirection to https://1XX.XXX.XXX.XXX -> https://myha.duckdns.org ? My goal was to forbidden access with my public ip…

Thank you !! (I join you my screenshot of error)

First of all, the message appears because your ip address is not listed in the SSL certificate, but your hostname is. So that’s all as expected.
What you want to do is to redirect incoming requests for your ip address to your hostname instead. In nginx that looks something like in the following example:

server {
    listen 80;
    
    # Listen to your server ip address
    server_name your-server-ip; 
    
    # Redirect all traffic coming from your-server-ip to your domain
    return 301 $scheme://example.com$request_uri;
}
1 Like