Mattermost Peer-to-Peer Forum

[SOLVED] Apache websocket error 500


#1

Hello, Im using apache as the proxy for mattermost, but I can’t get it work
I get :

ws://chatdomaincom/api/v4/websocket
Request Status Code:500 Internal Server Error

Here it is my configuration.

ServerName chatdomaincom
  ServerAdmin hostmaster@mydomain.com
  ProxyPreserveHost On


  setup the proxy
  <Proxy *>
         Order allow,deny
         Allow from all
  </Proxy>

  Set web sockets
  RewriteEngine On
  RewriteCond %{REQUEST_URI} ^/api/v4/websocket [NC,OR]
  RewriteCond %{HTTP:UPGRADE} ^WebSocket$ [NC,OR]
  RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]
  RewriteRule .* wss://127.0.0.1:8065%{REQUEST_URI} [P,QSA,L]
  RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
        # This line simply forces HTTPS
  #RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

  <Location /api/v4/websocket>
        Require all granted
        ProxyPass ws://127.0.0.1:8065/api/v4/websocket
        ProxyPassReverse ws://127.0.0.1:8065/api/v4/websocket
        ProxyPassReverseCookieDomain 127.0.0.1 chatdomaincom
  </Location>

  <Location />
        Require all granted
        ProxyPass http://127.0.0.1:8065/
        ProxyPassReverse http://127.0.0.1:8065/
        ProxyPassReverseCookieDomain 127.0.0.1 chatdomaincom
  </Location>

#2

Solved.

I needed poxy_wstunnel sudo a2enmod proxy_poxy_wstunnel

And in the virtualhost i added

RewriteEngine On
RewriteCond %{HTTP:Connection} Upgrade [NC]
RewriteCond %{HTTP:Upgrade} websocket [NC]
RewriteRule /(.*) ws://127.0.0.1:8065/$1 [P,L]


#3

@iFEARR,

Thanks for your feedback and for posting back your solution :slight_smile:

Pleased your issue is resolved.