Hi,
mein FHEM, inkl. FTUI3, läuft hinter einem Traefik-Proxy.
Irgendwann hab' ich festgestellt, dass sich meine Tablets nicht mehr per websocket upgedated haben. Es hat mich jetzt viel Sucherei gekostet, um folgendes herauszufinden:
Seit dem update auf Traefik >= 2.7.2 wandelt Traefik die Semikola (';') in den Query-Parametern in Ampersands ('&') um :(. Gefixt werden soll das wohl erst mit Traefik 3.0 (https://github.com/traefik/traefik/issues/9164)
Der Fix dazu ist einfach, nämlich nur die ';' im `inform`-Teil durch urlencoding '%3B' zu escapen:
diff --git a/www/ftui/modules/ftui/fhem.service.js b/www/ftui/modules/ftui/fhem.service.js
index 1c904c5..bd0e6f8 100755
--- a/www/ftui/modules/ftui/fhem.service.js
+++ b/www/ftui/modules/ftui/fhem.service.js
@@ -241,8 +241,10 @@ class FhemService {
if (this.config.debuglevel > 1) {
this.debugEvents.publish('FHEM connection started');
}
- this.states.connection.URL = this.config.fhemDir.replace(/^http/i, 'ws') + '?XHR=1&inform=type=status;filter=' +
- this.config.update.filter + ';since=' + this.states.connection.lastEventTimestamp.getTime() + ';fmt=JSON' +
+
+ // use urlencoding for ';' to workround bug in traefik (https://github.com/traefik/traefik/issues/9164)
+ this.states.connection.URL = this.config.fhemDir.replace(/^http/i, 'ws') + '?XHR=1&inform=type=status%3Bfilter=' +
+ this.config.update.filter + '%3Bsince=' + this.states.connection.lastEventTimestamp.getTime() + '%3Bfmt=JSON' +
'×tamp=' + Date.now();
log(1, '[websocket] create new connection - URL = ' + this.states.connection.URL);
Das geht vermutlich mit `encodeURI()` noch schicker.
LG
Christian