# Failed to upgrade websocket connection

**URL:** <https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963>\
**Category:** Troubleshooting\
**Created:** [February 11, 2020, 10:16am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963 "2020-02-11T10:16:07Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![robert9780](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robert9780](https://forum.mattermost.com/u/robert9780)\
**Post date:** [February 11, 2020, 10:16am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/1 "2020-02-11T10:16:07Z")

</div>

#### Summary

mattermost client alert a red bar on the top ,shows  
Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port

#### Steps to reproduce

My site is mattermost 5.19.1 on windows 2016  
with reverse proxy on IIS  
\<config.json\>  
{  
“ServiceSettings”: {  
“SiteURL”: “[http://mmtest.XXX.com.tw](http://mmtest.XXX.com.tw)”,  
“WebsocketURL”: “”,  
“LicenseFileLocation”: “”,  
“ListenAddress”: “:8065”,  
“ConnectionSecurity”: “”,  
“TLSCertFile”: “”,  
“TLSKeyFile”: “”,  
“TLSMinVer”: “1.2”,  
“TLSStrictTransport”: false,  
“TLSStrictTransportMaxAge”: 63072000,  
“TLSOverwriteCiphers”: [],  
“UseLetsEncrypt”: false,  
“LetsEncryptCertificateCacheFile”: “./config/letsencrypt.cache”,  
“Forward80To443”: false,  
“TrustedProxyIPHeader”: [  
“X-Forwarded-For”,  
“X-Real-IP”  
],  
“ReadTimeout”: 300,  
“WriteTimeout”: 300,  
“MaximumLoginAttempts”: 10,  
“GoroutineHealthThreshold”: -1,  
“GoogleDeveloperKey”: “”,  
“EnableOAuthServiceProvider”: false,  
“EnableIncomingWebhooks”: true,  
“EnableOutgoingWebhooks”: true,  
“EnableCommands”: true,  
“EnableOnlyAdminIntegrations”: true,  
“EnablePostUsernameOverride”: false,  
“EnablePostIconOverride”: false,  
“EnableLinkPreviews”: false,  
“EnableTesting”: false,  
“EnableDeveloper”: false,  
“EnableSecurityFixAlert”: true,  
“EnableInsecureOutgoingConnections”: false,  
“AllowedUntrustedInternalConnections”: “”,  
“EnableMultifactorAuthentication”: false,  
“EnforceMultifactorAuthentication”: false,  
“EnableUserAccessTokens”: false,  
“AllowCorsFrom”: “”,  
“CorsExposedHeaders”: “”,  
“CorsAllowCredentials”: false,  
“CorsDebug”: false,  
“AllowCookiesForSubdomains”: false,  
“SessionLengthWebInDays”: 180,  
“SessionLengthMobileInDays”: 180,  
“SessionLengthSSOInDays”: 30,  
“SessionCacheInMinutes”: 10,  
“SessionIdleTimeoutInMinutes”: 43200,  
“WebsocketSecurePort”: 443,  
“WebsocketPort”: 80,  
“WebserverMode”: “gzip”,  
“EnableCustomEmoji”: false,  
“EnableEmojiPicker”: true,  
“EnableGifPicker”: false,  
“GfycatApiKey”: “2\_KtH\_W5”,  
“GfycatApiSecret”: “3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof”,  
“RestrictCustomEmojiCreation”: “all”,  
“RestrictPostDelete”: “all”,  
“AllowEditPost”: “always”,  
“PostEditTimeLimit”: -1,  
“TimeBetweenUserTypingUpdatesMilliseconds”: 5000,  
“EnablePostSearch”: true,  
“MinimumHashtagLength”: 3,  
“EnableUserTypingMessages”: true,  
“EnableChannelViewedMessages”: true,  
“EnableUserStatuses”: true,  
“ExperimentalEnableAuthenticationTransfer”: true,  
“ClusterLogTimeoutMilliseconds”: 2000,  
“CloseUnusedDirectMessages”: false,  
“EnablePreviewFeatures”: true,  
“EnableTutorial”: true,  
“ExperimentalEnableDefaultChannelLeaveJoinMessages”: true,  
“ExperimentalGroupUnreadChannels”: “disabled”,  
“ExperimentalChannelOrganization”: false,  
“ImageProxyType”: “”,  
“ImageProxyURL”: “”,  
“ImageProxyOptions”: “”,  
“EnableAPITeamDeletion”: false,  
“ExperimentalEnableHardenedMode”: false,  
“DisableLegacyMFA”: true,  
“ExperimentalStrictCSRFEnforcement”: false,  
“EnableEmailInvitations”: true,  
“DisableBotsWhenOwnerIsDeactivated”: true,  
“EnableBotAccountCreation”: false,  
“EnableSVGs”: false,  
“EnableLatex”: false  
},  
…

#### Expected behavior

the site works well except **the websocket connection fail**

#### Observed behavior

mattermost web client alert a red bar on the top ,shows  
Please check connection, Mattermost unreachable. If issue persists, ask administrator to check WebSocket port

 ![errorPage](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/e/e9d2ae54fd1559dd4ce118ecec19ee5d81ea7696.jpeg)

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [February 11, 2020, 1:32pm UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/2 "2020-02-11T13:32:06Z")

</div>

Have you had a chance to take a look at our troubleshooting docs [https://docs.mattermost.com/install/troubleshooting.html#please-check-connection-mattermost-unreachable-if-issue-persists-ask-administrator-to-check-websocket-port](https://docs.mattermost.com/install/troubleshooting.html#please-check-connection-mattermost-unreachable-if-issue-persists-ask-administrator-to-check-websocket-port)?

---

<div class="post-metadata">

**Author:** ![robert9780](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robert9780](https://forum.mattermost.com/u/robert9780)\
**Post date:** [February 12, 2020, 1:13am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/3 "2020-02-12T01:13:13Z")

</div>

Thks for the reoly,the article did not help,  
I use IIS with the websocket installed ( not using NGINX as proxy)  
Configure reverse proxy by the following steps  
1.Download the URL Rewrite 2.0 x64 module.  
2.Download the Application Request Routing 3.0 x64 module.  
3.Install the modules (trivial installers with no customizations or options to select).  
4.On the Start page, click the Server Manager tile, and then click OK.  
5.Expand the Tools menu, and select Information Information Services (IIS) Manager.  
6.In the left-hand navigation tree, expand the server node, expand Sites, and select Default Web Site.  
7.Double-click the URL Rewrite feature  
8.In the actions pane (far-right), select Add Rule(s)…  
9.Select Reverse Proxy and press OK.  
10.In the Add Reverse Proxy Rules dialog,  
11.Enter 10.0.0.2:8065 in the Enter the server name or IP address where HTTP requests will be forwarded field.  
12.Ensure the Enable SSL Offloading option is checked.  
13.Check Rewrite the domain names of the links in HTTP responses  
14.Enter 10.0.0.2:8065 in the From field.  
15.Enter [mattermost.example.com](http://mattermost.example.com) in the To field.  
16.Press OK  
the mattermost website work fine , but websocket connection fail (even browser on the server site)

Is there any way to fix that ?

---

<div class="post-metadata">

**Author:** ![robert9780](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robert9780](https://forum.mattermost.com/u/robert9780)\
**Post date:** [February 13, 2020, 2:39am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/4 "2020-02-13T02:39:59Z")

</div>

Is there any solution for this problem ? The troubleshooting docs did not help  
Is there any advice provided by your team?

---

<div class="post-metadata">

**Author:** ![amy.blais](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/amy.blais/32/7481_2.png) [@amy.blais](https://forum.mattermost.com/u/amy.blais)\
**Post date:** [February 13, 2020, 1:14pm UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/5 "2020-02-13T13:14:08Z")

</div>

@ahmaddanial Are you familiar with this issue?

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [February 13, 2020, 11:20pm UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/6 "2020-02-13T23:20:40Z")

</div>

Hello, @amy.blais @robert9780

Can you check on your developer tools to verify that the header and origin match each other? For example, this is what I see when I am logged in to `community.mattermost.com`:

 ![Screenshot 2020-02-14 at 07.16.54](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/1/1de6557e9792020fdfaf1ecb875ddc7e3d3d37fd.png)

- If not, you’ll need to add the origin to your `AllowCorsFrom ` parameter in `config.json`.
- If they match, double check the reverse proxy on IIS to make sure that they are forwarding the headers correctly.

---

<div class="post-metadata">

**Author:** ![robert9780](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robert9780](https://forum.mattermost.com/u/robert9780)\
**Post date:** [February 14, 2020, 6:07am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/7 "2020-02-14T06:07:40Z")

</div>

![errorPage01](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/e/e4d06601c7a0c59ec6cbb761d0b7f2ee6ee88bf0.jpeg)  
As the pictures shows , the Host and Origin matches ,  
and the IIS URL rewrite setting like below  
 ![errorPage02](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/2X/c/ccc00780a81641b598228fb16100462520465096.jpeg)  
Is this means the IIS reverse proxy forward the right headers?

If so , the problem is still there. It’s so upset…

---

<div class="post-metadata">

**Author:** ![robert9780](https://avatars.discourse-cdn.com/v4/letter/r/9dc877/32.png) [@robert9780](https://forum.mattermost.com/u/robert9780)\
**Post date:** [February 14, 2020, 8:48am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/8 "2020-02-14T08:48:45Z")

</div>

@ahmaddanial  
I add the origin to ‘AllowCorsFrom’ parameter in `config.json` and it works!  
Thanks for your help!

---

<div class="post-metadata">

**Author:** ![ahmaddanial](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/ahmaddanial/32/2938_2.png) [@ahmaddanial](https://forum.mattermost.com/u/ahmaddanial)\
**Post date:** [February 14, 2020, 2:36pm UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/9 "2020-02-14T14:36:59Z")

</div>

You are most welcome, @robert9780 Any time!

---

<div class="post-metadata">

**Author:** ![neethu](https://avatars.discourse-cdn.com/v4/letter/n/58956e/32.png) [@neethu](https://forum.mattermost.com/u/neethu)\
**Post date:** [March 12, 2020, 8:28am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/10 "2020-03-12T08:28:07Z")

</div>

I’m also facing same issue only in mobile browser . Desktop/browser apps is not showing the error.  
I have added AllowCorsFrom to \*. But no luck. Any help ?

---

<div class="post-metadata">

**Author:** ![burnell](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/burnell/32/4394_2.png) [@burnell](https://forum.mattermost.com/u/burnell)\
**Post date:** [December 22, 2020, 8:18am UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/11 "2020-12-22T08:18:58Z")

</div>

hi robert，  
I have the same issue,  
can you help me to sovled this problem?  
thanks a lot

---

<div class="post-metadata">

**Author:** ![XxLilBoPeepsxX](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/xxlilbopeepsxx/32/4993_2.png) [@XxLilBoPeepsxX](https://forum.mattermost.com/u/XxLilBoPeepsxX)\
**Post date:** [December 24, 2020, 8:23pm UTC](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/12 "2020-12-24T20:23:21Z")

</div>

In the system console of your Mattermost instance, in the CORS configuration section, add a `*` to the record, and click save. This should fix it, according to [Post #8](https://forum.mattermost.com/t/failed-to-upgrade-websocket-connection/8963/8)
