UsingTLS encrypted websocket

Hi Stefan,

I´ve tried your example - but without success. Maybe a stupid question: how can the backend jar-file know where to find the web-documents?

What I did:

  • ng build -c “openems,openems-backend-prod,prod” in VS Code to generate web documents for backend-UI. I’ve put them in “/usr/share/openems-backend/www”
  • The first approaches are with the apache-configuration I´ve found in this thread.
  • I’ve installed nginx with the configuration similar to the one you’ve posted:
    server_name example.org;
    listen 443 ssl;

    # SSL Configuration
    ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

    # Proxy for OpenEMS UI -> OpenEMS Backend
    location /openems-backend-ui {
        proxy_pass http://127.0.0.1:8082;
        proxy_ssl_server_name on;
        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-Forwarded-Proto $scheme;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

        access_log /var/log/nginx/ui-to-backend.access.log;
        error_log /var/log/nginx/ui-to-backend.error.log;
    }

Now I am wondering how the WebDocuments can be found. If I get it right nginx directly passes requests from a browser (https) to port 8082 (http) , right?

regards,
klinki

1 Like