[SOLVED] Apache websocket error 500

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

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

  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://{REQUEST_URI} [P,QSA,L]
        # This line simply forces HTTPS
  #RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent]

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

  <Location />
        Require all granted
        ProxyPassReverseCookieDomain chatdomaincom


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://$1 [P,L]

1 Like


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

Pleased your issue is resolved.