LAN-only without SSL mattermost setup causing CORS errors

Hi, thanks again for your patience.

Apologies for being late to reply to my own opened question, but I was a little bit busy last week, and I had to wait until the weekend to do further tests, and I solved the issue!

I will try to answer as shortly as possible, still being exhaustive.

Solution

In particular, by setting DOMAIN as in the following line of the .env file:

It is wrong to set (in the same .env file):

The correct way of setting it is:

MM_SERVICESETTINGS_SITEURL=http://${DOMAIN}:8065

No need of setting AllowCORS From to “*”

Why

As written in the documentation here,

The URL that users use to access Mattermost. The port number is required if it’s not a standard port, such as 80 or 443. This field is required.

As said in the same documentation paragraph, this can be set through MM_SERVICESETTINGS_SITEURL, and hence, since the default port on which I am serving it is the default one from the container, I also needed to specify :8065.

How I discovered this problem

As said from the documentation here, the system config path of Mattermost is visible at System Config path: Environment > Web Server from the webUI. At that page, when MM_SERVICESETTINGS_SITEURL was set wrongly to http://${DOMAIN}, the Test Live URL button returned an error. By setting instead MM_SERVICESETTINGS_SITEURL to http://${DOMAIN}:8065, the test became successful, and the banner did not appear again.

After changing the environment variable, I deleted volumes and re-created everything, not sure if changing it and restarting the containers would be enough.


Hope this will be useful for others who may encounter this problem! Thanks again for the patience!

1 Like