0

I'm not making any progress with my Mattermost installation on my server. I've installed everything without any problems.

After that I've enabled the apache mod proxy_wstunnel and added the following directives in my Plesk domain for additional directives (it like <VirtualHost *:80> or <VirtualHost *:443>):

HTTP:

ErrorLog ${APACHE_LOG_DIR}/mattermost-error.log
CustomLog ${APACHE_LOG_DIR}/mattermost-access.log combined

# Enforce HTTPS:
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

HTTPS:

ServerName mattermost.xxx.de
ProxyPreserveHost On

# Set web sockets
ProxyRequests Off
RemoteIPHeader CF-Connecting-IP
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/api/v[0-9]+/(users/)?websocket [NC,OR]
RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
RewriteRule .* ws://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule .* http://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
RequestHeader set X-Forwarded-Proto "https"

<LocationMatch "^/api/v(?<apiversion>[0-9]+)/(?<apiusers>users/)?websocket">
    Require all granted
    ProxyPass ws://127.0.0.1:8065/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
    ProxyPassReverse ws://127.0.0.1:8065/api/v%{env:MATCH_APIVERSION}/%{env:MATCH_APIUSERS}websocket
    ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.de
</LocationMatch>

<Location />
    Require all granted
    ProxyPass http://127.0.0.1:8065/
    ProxyPassReverse http://127.0.0.1:8065/
    ProxyPassReverseCookieDomain 127.0.0.1 mattermost.xxx.de
</Location>

But when I save this, restart apache and go back to Mattermost, I'm still getting the Websocket error:

enter image description here

In the network tab the response is empty....

3
  • Try to comment out the LocationMatch. – SYN Jan 30 at 16:13
  • @SYN Still not working without it – Mr. Jo Jan 30 at 21:45
  • Can you add apache and mattermost logs? Who's returning that 200? From your browser developer tools, network tab, you should be able to find the response body returned when querying that /api/v4/websocket URL, maybe you would find something interesting there ... Websocket upgrade should return with a 201 code. – SYN Jan 31 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.