Hello,
I just went through the Getting Started page of openems and in the “Configure the Controller Api Backend Component” section it says “For a production setup you would want to use a TLS encrypted websocket with a wss:// uri.” I was just curious what you need to configure to switch websocket protocol from “ws://” to “wss://”.
over the internet. Which works fine.
I´ve realized this with a let´s encrypt certificate.
XXX is the domain-name
I had to use this port because the standard port for https (443) is already in use.
The configuration on the backend is taken from the getting started guide - which is port 8081.
As I´ve mentioned: edge->backend is working but I could not establish a secure backend-ui connection over SSL. If the SSL stuff is commented out: everything works fine. With SSL it does not. But I post the faulty config also:
<VirtualHost *:8285>
ServerName XXX.org
ServerAdmin Thomas@klinki.com
DocumentRoot "/usr/share/openems-backend/www"
SSLEngine on
SSLCertificateFile /etc/letsencrypt/live/XXX.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/XXX.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
# WebSocket Proxy - Apply only to WebSocket requests
<Location /openems-backend-ui>
ProxyPass ws://127.0.0.1:8082/openems-backend-ui
ProxyPassReverse ws://127.0.0.1:8082/openems-backend-ui
Header set Connection upgrade
Header set Upgrade websocket
</Location>
# HTTP Proxy - Apply to all other requests
ProxyPass / http://127.0.0.1:8082/
ProxyPassReverse / http://127.0.0.1:8082/
<Directory "/usr/share/openems-backend/www">
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
</VirtualHost>
Maybe you can give me advice after you´ve taken the first steps connecting your edge device.
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?
But isn’t that some kind of double SSL offloading? In my opinion, it would be sufficient to secure only the first connection to the UI. Anyway, I’ll keep experimenting and maybe I can get the Apache configuration working as well.
No, both connections need to be secured. One is to provide the HTML - there it’s good practice nowadays to have it TLS encrypted (https://). The other one is for the Websocket connection (wss://), which is critical, because it’s used for sensitive data. One could manually create a connection to wss:// even without the UI, see B2bWebsocketTest for an example.