Problem :
URL is http://domain.com:443/….
protocol http is difference than port
Solution :
edit nginx vhost like this :
upstream domain.com { server 192.168.1.15:8401; } server { if ($host = domain.com) { return 301 https://$host$request_uri; } if ($host = www.domain.com) { return 301 https://$host$request_uri; } listen 80; server_name domain.com *.domain.com; return 404; } server { listen 443 ssl http2; server_name domain.com www.domain.com; ssl_certificate /etc/letsencrypt/live/domain.com/fullchain.pem; # managed by Certbot ssl_certificate_key /etc/letsencrypt/live/domain.com/privkey.pem; # managed by Certbot include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot add_header Content-Security-Policy "upgrade-insecure-requests"; error_page 497 301 =307 https://$host:$server_port$request_uri; if ($scheme = http) { return 301 https://$host$request_uri; } location / { proxy_pass http://domain.com; proxy_redirect http:// https://; # proxy_redirect http:// $scheme://; proxy_set_header X-Scheme $scheme; # proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2; proxy_redirect http://192.168.1.15:8401 https://domain.com; # proxy_ssl_server_name on; proxy_set_header Host $host; # proxy_set_header Host $host:$server_port; 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 X-FORWARDED-PROTO https; proxy_set_header X-Forwarded-Port 443; proxy_set_header X-Forwarded-Proto $scheme; proxy_redirect off; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_cache_bypass $http_upgrade; proxy_headers_hash_max_size 1024; proxy_headers_hash_bucket_size 1024; } }