I'm having the same issue with Apache 2.4.6 and CentOS 7 with https.
"Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port." message and all connections through wss:// return 301.
<VirtualHost *:443>
ServerName mattermost.example.com
ServerSignature Off
# TLS
SSLEngine on
SSLProtocol all -SSLv2
SSLHonorCipherOrder on
Header add Strict-Transport-Security: "max-age=15768000;includeSubdomains"
SSLCompression Off
SSLCertificateKeyFile /.../privkey.pem
SSLCertificateFile /.../cert.pem
SSLCertificateChainFile /.../chain.pem
ProxyPreserveHost On
RewriteEngine On
SSLProxyEngine On
RewriteCond %{REQUEST_URI} ^/api/v1/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]
# Be sure to uncomment the next 2 lines if https is used
RequestHeader set X-Forwarded-Proto "https"
# Prevent apache from sending incorrect 304 status updates
RequestHeader unset If-Modified-Since
RequestHeader unset If-None-Match
<Location /api/v1/websocket>
Require all granted
ProxyPassReverse ws://127.0.0.1:8065/api/v1/websocket
ProxyPassReverseCookieDomain 127.0.0.1 mattermost.example.com
</Location>
<Location />
Require all granted
ProxyPassReverse http://127.0.0.1:8065/
ProxyPassReverseCookieDomain 127.0.0.1 mattermost.example.com
</Location>
ProxyPreserveHost On
ProxyRequests Off
</VirtualHost>