Openhab cloud doesn't work with https

Hello, I install own openhab cloud server. It works with http excellent, but I need to configurate https
Now I have self-signed SSl.(after configuration I will buy SSL) but my openhab doesnt connect to my server by https. config of nginx

server {
listen 80 default_server;
listen [::]:80 default_server;

#SSL configuration 
if ( $scheme = "http" ) {
    rewrite ^/(.*)$    https://$host/$1 permanent;
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
include snippets/self-signed.conf;
include snippets/ssl-params.conf;
charset utf-8;
access_log /var/log/nginx/;
error_log /var/log/nginx/openhabcloud-error.log;
client_max_body_size 300m;
location /css {
    alias  /home/uu772hpj/openhab-cloud/public/css;
location /js {
    alias /home/uu772hpj/openhab-cloud/public/js;
location /img {
    alias /home/uu772hpj/openhab-cloud/public/img;
location /bootstrap {
    alias /home/uu772hpj/openhab-cloud/public/bootstrap;
location /font-icons {
    alias /home/uu772hpj/openhab-cloud/public/font-icons;
location /fonts {
    alias /home/uu772hpj/openhab-cloud/public/fonts;
location /js-plugin {
    alias /home/uu772hpj/openhab-cloud/public/js-plugin;
location /staff/js-plugin {
    alias /home/uu772hpj/openhab-cloud/public/js-plugin;
location /downloads {
    alias /home/uu772hpj/openhab-cloud/public/downloads;
location / {
    proxy_pass http://localhost:3000;
    proxy_redirect off;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "upgrade";
    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 https;
#error_page 404 /404.html; 
#redirect server error pages to the static page /50x.html 
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;

In Web browser it redirect from http to https, and work excellent, but openhab cant connect((

It’s probably because your browser doesn’t trust your self signed certificate. And don’t pay money to buy a certificate, use Free ssl certificates for anyone, and easy to set up. (Lots of tutorials online)


Just looked at your nginx config a bit closer and noticed that you have two different listen directives in the same server block. I don’t think nginx supports that. Everything from ‘listen 443 ssl …’ should go in a separate server block I think.