Caddy is listening on ports 80 and 443, but your browser is trying to connect on port 8081. Is there configuration to change the websocket port to 443 (or omit the port, because default for wss:// is 443)? Port 8081 is what Caddy proxies to.
Yes, I can use the Phoscon Docker image to set the port to 443. The websocket connection will then be established. Caddy and the Phoscon app are in a docker network (realized via docker-compose).
So far so good, but I don’t really understand why another port doesn’t work? I would have thought that the port is only relevant for the proxy. This means in reverse that I can never adjust the incoming WSS port? (The nginx config above works fine with an other port)
To do this, the browser would need to attempt to connect on port 443, so the app would need to tell the browser that the websocket port to use is 443 (or just omit it because like I said, default for wss:// is 443), so it would try to connect to wss://phoscon.lan instead.
You could make Caddy listen on another port as well if this is easier for you, but it means you’d need to configure the Caddy container to also publish that port, and if you mean to access it from outside your network, port forward that as well.