# \[Solved\] 500 Code in Apache log because of Websocket

**URL:** <https://forum.mattermost.com/t/solved-500-code-in-apache-log-because-of-websocket/1557>\
**Category:** Troubleshooting\
**Created:** [May 23, 2016, 4:23pm UTC](https://forum.mattermost.com/t/solved-500-code-in-apache-log-because-of-websocket/1557 "2016-05-23T16:23:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Toni](https://avatars.discourse-cdn.com/v4/letter/t/8797f3/32.png) [@Toni](https://forum.mattermost.com/u/Toni)\
**Post date:** [May 23, 2016, 4:23pm UTC](https://forum.mattermost.com/t/solved-500-code-in-apache-log-because-of-websocket/1557/1 "2016-05-23T16:23:03Z")

</div>

Hello everyone

I just upgraded Mattermost to the version 3.0.2. It works all fine only that I see in the apache log this:

[23/May/2016:17:56:18 +0200] “GET /api/v3/users/websocket HTTP/1.1” 500

Here is the relevant configuration of my apache:

RewriteEngine On

RewriteCond %{REQUEST\_URI} ^/api/v3/users/websocket [NC,OR]  
RewriteCond %{HTTP:UPGRADE} ^Websocket$ [NC,OR]  
RewriteCond %{HTTP:CONNECTION} ^Upgrade$ [NC]  
RewriteRule .\* ws://xxxx:8065%{REQUEST\_URI} [P,QSA,L]

RewriteCond %{DOCUMENT\_ROOT}/%{REQUEST\_FILENAME} !-f  
RewriteRule .\* [http://xxxx:8065](http://xxxx:8065)%{REQUEST\_URI} [P,QSA,L]  
RequestHeader set X-Forwarded-Proto “https”

\<Location /api/v3/users/websocket\>  
Require all granted  
ProxyPassReverse ws://xxxx:8065/api/v3/users/websocket  
ProxyPassReverseCookieDomain xxxx:8065 xxxx

 Require all granted ProxyPassReverse http:/xxxx:8065/ ProxyPassReverseCookieDomain xxxx xxxx

I don’t understand because Apache gives a 500 because i think Mattermost works fine like before. The only thing that I noticed is that the browser takes longer until it gets the status of the other users.

Thanks for your help

---

<div class="post-metadata">

**Author:** ![Tarek](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@Tarek](https://forum.mattermost.com/u/Tarek)\
**Post date:** [June 15, 2016, 9:15pm UTC](https://forum.mattermost.com/t/solved-500-code-in-apache-log-because-of-websocket/1557/2 "2016-06-15T21:15:19Z")

</div>

Hello,

I was wondering if you resolved this. If so, could you post your answer for us? I have [reported a problem](http://forum.mattermost.com/t/submitting-new-message-remains-gray/1679) that led me to [a configuration that no longer works](http://forum.mattermost.com/t/solved-apache2-reverseproxy-with-websocket-https/437/3). If you got yours working, that would be great.

Thank you

---

<div class="post-metadata">

**Author:** ![Tarek](https://avatars.discourse-cdn.com/v4/letter/t/cdc98d/32.png) [@Tarek](https://forum.mattermost.com/u/Tarek)\
**Post date:** [June 15, 2016, 9:39pm UTC](https://forum.mattermost.com/t/solved-500-code-in-apache-log-because-of-websocket/1557/3 "2016-06-15T21:39:15Z")

</div>

I resolved my issue using [advice from this thread](http://forum.mattermost.com/t/apache-2-4-mod-proxy-wstunnel-https-websockets/863). In essence, It required the addition of the mod\_proxy\_wstunnel. In Jessie, I did it with:

`sudo a2enmod proxy_wstunnel`

For posterity, here’s the working config:

```auto
<VirtualHost x.x.x.x:443>
ServerName my.mattermost.org
SSLCertificateFile /etc/letsencrypt/live/my.mattermost.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/my.mattermost.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf

ProxyPreserveHost On
ProxyRequests Off

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/api/v3/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"

  <Location /api/v3/users/websocket>
    Require all granted
    ProxyPassReverse ws://127.0.0.1:8065/api/v3/users/websocket
    ProxyPassReverseCookieDomain 127.0.0.1 my.mattermost.org
  </Location>

  <Location />
    Require all granted
    ProxyPassReverse https://127.0.0.1:8065/
    ProxyPassReverseCookieDomain 127.0.0.1 my.mattermost.org
  </Location>
</VirtualHost>

```
