# \[Solved\] Mattermost websocket error

**URL:** <https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957>\
**Category:** Troubleshooting\
**Created:** [October 13, 2017, 2:43pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957 "2017-10-13T14:43:21Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![farahfa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/farahfa/32/1641_2.png) [@farahfa](https://forum.mattermost.com/u/farahfa)\
**Post date:** [October 13, 2017, 2:43pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/1 "2017-10-13T14:43:21Z")

</div>

Hello,

Gitlab Mattermost is giving us the following error:

```auto
Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port.

```

And Gitlab logs show the following:

```auto
==> /var/log/gitlab/mattermost/mattermost.log <==
[2017/10/13 04:40:49 UTC] [EROR] /api/v4/websocket:connect code=500 rid=ycji7i9ht7838fk4hkpb5nbtdw uid=8z1d45uhotnuifu5pqb93gp5ca ip=10.96.2.86 Failed to upgrade websocket connection [details:]
[2017/10/13 04:42:04 UTC] [EROR] websocket connect err: websocket: 'Origin' header value not allowed

==> /var/log/gitlab/mattermost/current <==
2017-10-13_04:42:04.62615 ip-10-96-15-151 mattermost: 2017/10/13 04:42:04 http: multiple response.WriteHeader calls
2017-10-13_04:42:04.62622 ip-10-96-15-151 mattermost: [2017/10/13 04:42:04 UTC] [EROR] websocket connect err: websocket: 'Origin' header value not allowed
2017-10-13_04:42:04.62625 ip-10-96-15-151 mattermost: [2017/10/13 04:42:04 UTC] [EROR] /api/v4/websocket:connect code=500 rid=dczoyarprjdnxreigi5tj4tr7a uid=8z1d45uhotnuifu5pqb93gp5ca ip=10.96.2.86 Failed to upgrade websocket connection [details:]

```

It’s behind an ELB with the following configs and the SSL is terminating there ([followed this advice](https://gitlab.com/gitlab-org/gitlab-ce/issues/21647#note_14720355)).

ELB listeners are as follows:

 ![17 AM](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/1/157bd53907bc4bc221dcb0d600ca459fe097272f.jpg)

(I added the 8065 part just for testing).

Here’s my mattermost configs in `gitlab.rb` that’s relevant for this issue:

```auto
mattermost_external_url 'https://chat.company.com'
mattermost['enable'] = true
mattermost['service_address'] = "127.0.0.1"
mattermost['service_port'] = "8065"

mattermost_nginx['enable'] = true
mattermost_nginx['listen_port'] = 1234
mattermost_nginx['listen_https'] = false
mattermost_nginx['proxy_set_headers'] = {
  "Host" => "$http_host",
  "X-Real-IP" => "$remote_addr",
  "X-Forwarded-For" => "$proxy_add_x_forwarded_for",
  "X-Frame-Options" => "SAMEORIGIN",
  "X-Forwarded-Proto" => "https",
  "X-Forwarded-Ssl" => "on",
  "Upgrade" => "$http_upgrade",
  "Connection" => "$connection_upgrade"
}

```

How can I get rid of this issue? What am I doing wrong here?

Thanks,

EDIT: We are on Gitlab Mattermost (version 4.2). Also, opened a ticket in Gitlab but [they asked me to come and ask for help here](https://gitlab.com/gitlab-org/gitlab-ce/issues/39088#note_43358385).

---

<div class="post-metadata">

**Author:** ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)\
**Post date:** [October 16, 2017, 7:02am UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/2 "2017-10-16T07:02:18Z")

</div>

Hello @farahfa,

Thanks for your feedback,

Perhaps [this websocket troubleshooting documentation](https://docs.mattermost.com/install/troubleshooting.html#please-check-connection-mattermost-unreachable-if-issue-persists-ask-administrator-to-check-websocket-port) will help?

You could also try updating to the [latest Mattermost version](https://about.mattermost.com/download/) which shipped today (10/16).

Let us know how it goes?

---

<div class="post-metadata">

**Author:** ![farahfa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/farahfa/32/1641_2.png) [@farahfa](https://forum.mattermost.com/u/farahfa)\
**Post date:** [October 16, 2017, 3:30pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/3 "2017-10-16T15:30:18Z")

</div>

Hi @lindy65,

Well, we are using Mattermost through the latest Gitlab Omnibus package. Also, Following that websocket troubleshooting page we can see that websocket’s status is 403.

![websocket](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex020/uploads/mattermost/original/2X/f/f718617d6330d22146a38b8c9dcc55d23a45773d.png)

We tried do a port forward (TCP) from 1234, which is the port that Mattermost is listening to (check the Gitlab nginx config above in the OP), to 8065 (Also TCP), but still the same error.

![ELB](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex020/uploads/mattermost/original/2X/a/a0f938429dbcb91ebc3d3c02e591ca3406f1e817.png)

---

<div class="post-metadata">

**Author:** ![lindy65](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/lindy65/32/1811_2.png) [@lindy65](https://forum.mattermost.com/u/lindy65)\
**Post date:** [October 16, 2017, 5:05pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/4 "2017-10-16T17:05:50Z")

</div>

Thanks for posting back your results @farahfa,

I’ll post this to the team and see if the devs have any suggestions for you.

---

<div class="post-metadata">

**Author:** ![farahfa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/farahfa/32/1641_2.png) [@farahfa](https://forum.mattermost.com/u/farahfa)\
**Post date:** [October 23, 2017, 1:01pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/5 "2017-10-23T13:01:27Z")

</div>

Hi @lindy65, anything new about this issue?

---

<div class="post-metadata">

**Author:** ![jasonblais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/jasonblais/32/720_2.png) [@jasonblais](https://forum.mattermost.com/u/jasonblais)\
**Post date:** [October 23, 2017, 5:30pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/6 "2017-10-23T17:30:06Z")

</div>

@farahfa What is your `mattermost['service_allow_cors_from']` config setting set to?

---

<div class="post-metadata">

**Author:** ![ccbrown](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ccbrown/32/1822_2.png) [@ccbrown](https://forum.mattermost.com/u/ccbrown)\
**Post date:** [October 23, 2017, 5:52pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/7 "2017-10-23T17:52:41Z")

</div>

@farahfa Can you click on one of those connections in the developer console and confirm that the “Host” and “Origin” headers match each other?

![11 PM](https://cdck-file-uploads-us1.s3.dualstack.us-west-2.amazonaws.com/flex020/uploads/mattermost/original/2X/9/97436eb4e13ad52288ea24b3e4363296fb5e4f7e.png)

If not, you’ll need to add the origin to your “service\_allow\_cors\_from” setting.

If they do match, double check any proxies you have in place to make sure that they’re forwarding those headers correctly. For example, if you’re using CloudFront, you need to ensure that it’s forwarding the Origin and Host headers.

---

<div class="post-metadata">

**Author:** ![farahfa](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/farahfa/32/1641_2.png) [@farahfa](https://forum.mattermost.com/u/farahfa)\
**Post date:** [October 27, 2017, 3:45am UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/8 "2017-10-27T03:45:32Z")

</div>

Thanks, changing the `mattermost['service_allow_cors_from']` fixed the issue for me.

---

<div class="post-metadata">

**Author:** ![ashley-mort](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ashley-mort/32/6313_2.png) [@ashley-mort](https://forum.mattermost.com/u/ashley-mort)\
**Post date:** [January 29, 2023, 3:07pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/9 "2023-01-29T15:07:22Z")

</div>

I get this error. Any tips to further troubleshoot this within the MM desktop app?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/3/3b267f8f0025d9052eef6509f1d2a0d0d7d64219.png)

---

<div class="post-metadata">

**Author:** ![agriesser](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/agriesser/32/5644_2.png) [@agriesser](https://forum.mattermost.com/u/agriesser)\
**Post date:** [January 29, 2023, 3:30pm UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/10 "2023-01-29T15:30:04Z")

</div>

Hi @ashley-mort and welcome to the Mattermost forums!

This topic is already solved, please create a new one and describe the problem you’re seeing with a few more details, like the server version you’re using, the desktop app version and what exactly the problem is. In your screenshot f.ex. I cannot see an error message.

---

<div class="post-metadata">

**Author:** ![dishoneprabu](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/dishoneprabu/32/7132_2.png) [@dishoneprabu](https://forum.mattermost.com/u/dishoneprabu)\
**Post date:** [August 16, 2023, 11:26am UTC](https://forum.mattermost.com/t/solved-mattermost-websocket-error/3957/11 "2023-08-16T11:26:14Z")

</div>

@farahfa

Where do you check this **mattermost[‘service\_allow\_cors\_from’]**

I couldn’t find this line in the config file
