KnoJoh
Ich hatte nach dem Update ebenfalls das Problem, dass der Live-Status in der Admin-GUI mit 502 Bad Gateway abgebrochen ist. Ich habe mir mit Hilfe von ChatGPT einen Workaround gebaut.
Im nginx admin error log stand dabei:
upstream sent "Content-Length" and "Transfer-Encoding" headers at the same time while reading response header from upstream
Der betroffene Request war:
GET /api/v1/system/vhostStatus/local
Der lokale nginx statusmonitor selbst funktionierte:
curl -i http://127.0.0.1:8080/statusmonitor
lieferte bei mir HTTP/1.1 200 OK.
Die Ursache lag offenbar in der grommunio-admin-api. In der Datei
/usr/share/grommunio-admin-api/endpoints/system/misc.py
wird in der Funktion vhostStatus(host) die Antwort des internen statusmonitor-Requests inklusive Headern ungefiltert zurückgegeben:
return res.raw.read(), res.status_code, res.headers.items()
Dadurch kamen bei nginx offenbar gleichzeitig Content-Length und Transfer-Encoding an, was nginx mit 502 ablehnt.
Als lokaler Workaround hat bei mir geholfen, in vhostStatus(host) die problematischen Header vor der Rückgabe zu entfernen.
Vorher Backup erstellen:
cp -a /usr/share/grommunio-admin-api/endpoints/system/misc.py \
/usr/share/grommunio-admin-api/endpoints/system/misc.py.bak-$(date +%F-%H%M)
Dann in:
/usr/share/grommunio-admin-api/endpoints/system/misc.py
innerhalb der Funktion:
def vhostStatus(host):
diese Zeile:
return res.raw.read(), res.status_code, res.headers.items()
ersetzen durch:
headers = dict(res.headers)
for header in ("Transfer-Encoding", "Content-Length", "Connection"):
headers.pop(header, None)
return res.raw.read(), res.status_code, headers.items()
Der Block sieht danach bei mir so aus:
@API.route(api.BaseRoute+"/system/vhostStatus/<path:host>", methods=["GET"])
@secure()
def vhostStatus(host):
checkPermissions(SystemAdminROPermission())
conf = Config["options"].get("vhosts", {})
if host not in conf:
return jsonify(message="VHost not found"), 404
try:
res = requests.get(conf[host], stream=True)
except BaseException as err:
API.logger.error(type(err).__name__+": "+" - ".join(str(arg) for arg in err.args))
return jsonify(message="Failed to connect to vhost"), 503
headers = dict(res.headers)
for header in ("Transfer-Encoding", "Content-Length", "Connection"):
headers.pop(header, None)
return res.raw.read(), res.status_code, headers.items()
Anschließend Syntax prüfen und Admin API neu starten:
python3 -m py_compile /usr/share/grommunio-admin-api/endpoints/system/misc.py
systemctl restart grommunio-admin-api
Danach funktionierte der Live-Status in der Admin-GUI wieder.
Wichtig: Das ist nur ein lokaler Workaround. Die Datei liegt unter /usr/share/... und kann bei einem Update überschrieben werden.