[SOLVED] Service_allow_cors_from parameter?


From the mobile application, I had a non-stop message : “connecting…” at the top of the screen.
If I set service_allow_cors_from=’*’ then the application connect successfully.

I suppose ‘*’ is a not a good solution, but I can not find what to enter here.
I tried with .mydomain.com , mattermost.mydomain.com , gitlab.mydomain.com
Only '
’ allow me to connect from the mobile app.

Can you help me to define the “right” value for this parameter ?


Hello @GuiGuiSoft,

Thanks for your feedback,

What server are you using?

Here is a doc that could help:

Hello @lindy65 ,

I am using Mattermost (the version embedded with GitLab 9.4.1).
My server is located on a virtual machine placed behind a reverse proxy, so every request to Mattermost should pass through the reverse proxy, either it comes from a webbrowser, or a desktop app or a mobile app, isn’t it ?

I read the documentation and I am asking myself if the ‘*’ is a secured configuration ?

Is there a way to know which domain is used by the user when I see this message in logs :
[2017/07/25 15:34:28 CEST] [EROR] Erreur de la connexion websocket : websocket: origin not allowed


Hi @GuiGuiSoft,

Thanks for your feedback,

I’m not totally sure about the answers to your questions so will chat to the devs and ask for their help.

@GuiGuiSoft can you share your server url? Have you set the siteURL setting? Does the server url in the app match the latter?

In the web browser when you open the javascript console what is the websocket address that you get?

Lets see if we can track this down

Hello @elias ,

I prefer to share the URL via private message if you agree :slight_smile:

As I use GitLab, I defined the following parameter
mattermost_external_url 'https://mattermost.mydomain.com'

If I toggle Developer Tools in the desktop app I can see
"[Mattermost] websocket connecting to wss://mattermost.mydomain.com:443/api/v4/websocket"
I don’t know how to see my browser console on my smartphone :stuck_out_tongue:

I don’t know if there is any relation but I have an other problem ( https://gitlab.com/gitlab-org/omnibus-gitlab/issues/2600 ).


Looks like your second issue is unrelated, I’ll send you a private message so we can move on with the cors issue and once we do we should post back the solution for it.

Problem Solved.

I think the problem appeared when there was a mismatch beetween mattermost_external_url and mattermost['service_site_url'].

I corrected the mismatch and restarted the server but did not logout/login from the mobile app ! So the problem remained only on my phone…

Thank you @elias for your precious advices :slight_smile:


Glad your issue is resolved @GuiGuiSoft :slight_smile:


Unfortunately I closed the issue to early. The problem came back a few hour ago and I don’t know why O_o

I still don’t understand why I have this issue only with the mobile app.
When I use the application through Desktop App or web browser I don’t have any error, but if I try to reach https://my-mattermost.com/api/v4/websocket I have this message :
Bad Request
{“id”:“api.web_socket.connect.upgrade.app_error”,“message”:“Échec de la mise-à-jour de la connexion websocket”,“detailed_error”:"",“request_id”:“5kakt3rkwfryjet8e1kmjxqg9o”,“status_code”:500}

Is it normal ?

Maybe I am in the same situation than here ( https://github.com/mattermost/mattermost-docker/issues/107 ) (even if I don’t user docker).
Do you think HTTP version (1.1 vs. 1.0) is important on the reverse proxy ?


I think I solved the problem adding the following parameters in the reverse proxy configuration

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;

It is strange that web browser and desktop application were not disturbed by the absence of these parameters o_O


Great news @GuiGuiSoft!

Thank you for posting back your solution :slight_smile: