-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
When generating --real-time-html output behind a reverse proxy (TLS terminated on 443), the produced HTML contains:
var connection = {"url":"wss://xyz/goaccess/ws/","port":7890,...}
Even though url is correct, the page sometimes attempts to connect to wss://xyz:7890/goaccess/ws/ (failing), so counters don’t update.
Manually patching HTML to "port": 443 makes it work reliably.
The man page of GoAccess documents that the WebSocket server listens on 7890 by default, but that’s the server-side listening port—not necessarily what the browser should connect to when you’re reverse-proxying over 443.
Expected behavior
If ws-url is wss://..., the generated client should:
- either omit port (so the browser uses 443),
- or derive it from the URL / window.location.port,
- or respect the port embedded in the ws-url (if any),
but not force 7890.
Actual behavior
port: 7890 is embedded in the HTML even when the websocket is accessed through 443.
How to reproduce
Run GoAccess with real-time HTML behind a TLS reverse proxy.
Use --ws-url=wss://<host>/goaccess/ws/
Open the report in a browser: it attempts wss://:7890/... intermittently and stops updating.
Environment
- GoAccess version: 1.9.3 and 1.9.4 (Docker allinurl/goaccess)
- Reverse proxy: Apache (wstunnel), TLS on 443
- Browser: Chrome/Firefox
Browser console
WebSocket connection to 'wss://xyz:7890/goaccess/ws/' failed:
ugly hack to make it work:
docker exec -it php-httpd sh -c '
set -e
f=/goaccess/goaccess.html
echo "BEFORE:"; grep -oE "var connection = \\{[^;]*\\}" "$f" | head -n 1
sed -i "s/\"port\"[[:space:]]*:[[:space:]]*7890/\"port\": 443/g" "$f"
echo "AFTER:"; grep -oE "var connection = \\{[^;]*\\}" "$f" | head -n 1
'