(gateway) only allows 80+443; this is directed to a reverse proxy. (I have now added ports 8443 and 8065 to point straight to my server.)
(reverse proxy) handles SSL, and it directs āhttps ā¦ chat.mydomain.tldā to server āhttp ā¦ 192.xxxx:8065ā
(server) is a Linux server running Docker with several containers. Mattermost is just one of many.
Mattermost deployed using steps 1ā¦4 given here: mattermost-com/deploy/
docker-compose.yml edited to include values from .env (see file here)
.env file edited to match my installation. (see file here)
Expected behavior
No warning banner.
Observed behavior
Log contains many lines like this:
DBG DBG web/context.go:113 > timestamp=2023-02-21 11:58:11.189 Z msg=Failed to upgrade websocket connection. path=/api/v4/websocket request_id=78z8jntyabdm5p5kdiw9b5td5w ip_addr=192.168.1.11 user_id=r8m9gk6mgfb7te3i79pco6r59h method=GET err_where=connect http_code=400 error=connect: Failed to upgrade websocket connection., websocket: the client is not using the websocket protocol: āupgradeā token not found in āConnectionā header
That sounds ā¦ strange. This is clearly a server-side issue, so how can one client work OK and another does not? On my installation, I see the same error both in web and in desktop clients.
Surely there is some server-side stuff needed, but I donāt see what. Port-forwarding? Docker port configuration? Something else? I do not know the first thing about āwebsocketsā.
The error is quite clear - your reverdse proxy does not handle websocket connections.
I have a similar setup, and using NGinx as a reverse proxy. Note my settings for the MTM location:
Thank you for the input, shurrman! I donāt see that the error is that clear, it does not mention any port?
āFailed to upgrade websocket connectionā
āāupgradeā token not found in āConnectionā headerā
How does this tell me that itās about the reverse proxy?
More importantly, how do I fix this? As stated, I have already port-forwarded 8065 and 8443 directly from my gateway to my server. Is that not it? What more is needed?
For reference, the reverse proxy I currently use is the āApplication Portalā built into my Synology NAS. Is āwebsocketā something special, something different than HTTP(S) requests, that this reverse proxy application does not support?
error=connect: Failed to upgrade websocket connection., websocket: the client is not using the websocket protocol: āupgradeā token not found in āConnectionā header
And I posted my reverse-proxy config, that handles exactly websockets-relarted stuff:
See - I set appropriate headers. I know nothing about what proxy is under the hood in your NAS and is/how it configurable. Websocket is not http, but it āstartsā over http.
If your reverse proxy can not handle Websockets (which I assume is true), probably the only thing you could try is to point your Gateway ā Server, and run docker-compose version of MTM with Nginx
docker-compose -f docker-compose.yml -f docker-compose.nginx.yml up -d
I think your suggestion will work to prove the Mattermost installation, but that method is impractical for actual use because no other services would be available; without any reverse proxy to direct traffic, I would then be running only that service.
I am looking to replace the Synology reverse proxy with Traefik instead, but thatās another separate project and I do not know whether Traefik supports websockets!
I am clearly not a network engineer, so this is frustratingly complicated. Thank you for your help!
Or do you use different ways/URLs to connect then?
If your client is able to establish the websocket connection using the browser, it should also be able to establish it using the desktop app.
Yes, I should think so. I just point the browser to the URL (https://chat.mydomain.tld/myorganisation), and I use the same information in the desktop/android app.
Hmmā¦ the /myorganisation at the end confuses me. According to your .env file, there is no /myorganisation part at the end.
Your SiteUrl is set to https://chat.g~~~~o.e~ without the /myorganisation at the end, the SSL certificate also looks fine, so Iām unsure about what the problem with the websockets could be.
When you open the menu of the desktop app, thereās an option to view the developer tools for the current server:
Would be interesting to see if there are any error messages in the console.
The ā/myorganisationā is the team name that I must enter at the very start of setting up Mattermost. In my case itās actually ā/gbā and you can see itās there:
I found the developer tools (looks like Firefox) and it has hundreds of entries like this:
and sometimes (but rarely) also entries like this:
You do not need to add the team name to the URL for connecting in the desktop app, maybe this is also the problem here. Please just use https://chat.yourdomain.eu, the desktop app will automatically add the teamname then once you logged in.
Can you remove the profile in your desktop app and try to create a new one with just the domain name in the connection details and let me know if that changes anything with regrads to the websockets?
If it doesnāt: Can you expand the error messages youāre seeing in the console here? Are there any more details available as to why the connect has been closed f.ex.?
First, I removed the existing server connection. I was sent to the normal welcome screen. This is expected. I entered the server URL, and I did not enter the ā/teamā part of the URL at the end. After some seconds, the familiar red error banner appears. See screenshots here (Imgur).
Expanding the error message does not reveal a lot. Is this useful?
Great to know (and I think my hint was the clueā¦)
But having Synology as a proxy/routerā¦ might be not the best ideaā¦ However it is solely your choice/way, and again glad to know you solved it
You are absolutely correct, and that is yet another work in progress. (So many ongoing projects in my home lab!) Using built-in functionality of Synology was an easy way to get started.
I am working on transitioning to Traefik running on a separate server machine, but of course Traefik is also a whole can of worms. Or, instead of Traefik, use Nginx directly, which is even more complicated. After all, people can make a full-time living based on these things; no wonder itās a bit overwhelming for an average IT guy!
I will get there eventually. This was one important step.