victronenergy / venus-docker

MIT License
28 stars 9 forks source link

Feature: configure nginx to forward `/websocket-mqtt` path to port 9001 #20

Closed mman closed 2 months ago

mman commented 2 months ago

Currently the venus-docker opens the following ports:

As of Venus 3.50 HTML5 app will by default connect to MQTT Websocket via the /websocket-mqtt path served from the same location as the main app, avoiding direct access to port 9001.

It is currently possible to redirect HTML5 app to a different MQTT Websocket by appending the &host=<VENUS_IP>&port=9001&path=%02%03 URL parameters.

It would be cool if Venus-docker would behave the same as Venus 3.50.

The fix essentially should be to add the following fragment to the nginx venus_app.conf file.

    location ~ ^/websocket-mqtt$ {
        proxy_pass http://127.0.0.1:9001;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host $host;
    }
mman commented 2 months ago

With this fixed it is possible to once again git clone + ./build.sh + ./run.sh -s gdf and then access http://localhost:8080 to directly open the latest version of html app together with the running simulation.