Mattermost, Inc.

Mattermost works in the browser, but not with the curl

Hi all,

I’ve installed Mattermost v5.1.1 on CentOS v7.5 and it works fine when I browse it by the server IP and default port. E.g. http://192.168.1.10:8065

However, when I try the same address to browse with the curl from the CentOS server itself (e.g. curl -i http://192.168.1.10:8065 ), it doesn’t works and I receive the following error: We're having trouble connecting to Mattermost. If refreshing this page (Ctrl+R or Command+R) does not work ...

When I try request API with the curl it works fine as well. E.g. curl -i -d '{"login_id":"usr","password":"pwd"}' http://192.168.1.10:8065/api/v4/users/login

My main problem (which is maybe related to the problem mentioned above) is, that I have nginx on the same CentOs server, which will proxy from the outside public url (https://mydomain.com/mattermost) to the internal mattermost url (http://192.168.1.10:8065). I need to use subpath in my public url, due to lack of public IP addressess. Outside of the mattermost/nginx server I have TMG firewall which proxy public URL with the subpath https://mydomain.com/mattermost to the nginx server which proxy to the mattermost internal URL.

When I try request mattermost from the public URL https://mydomain.com/mattermost (with nginx configured), I receive the same error (We're having trouble ...) as when I request mattermost with the curl (mentioned above)…

There are no errors or any interesting informations in the log files (nginx, mattermost). It looks, that everyting works fine. Mattermost log in the DEBUG mode shows just this information after my request: {"level":"debug","ts":1537612121.8941429,"caller":"web/handlers.go:50","msg":"GET - /"}

When I’ve created the simple website running on the same port and the server as mattermost and point nginx to this website and request public URL https://mydomain.com/mattermost it works fine. So nginx configuration looks to be fine.

Does anybody have an idea what is wrong in my configuration?

Thanks.

Hi @rasto, thank you for reaching out.

I’ll need to ask our developers to help with this as I couldn’t find relevant information to help resolve this issue after spending time on research.

@rasto, you mention needing to configure with a subpath, but your example API usage doesn’t show that (e.g. /mattermost/api/v4/users/login. Did you configure the SiteURL to reflect the subpath? It should be set to https://mydomain.com/mattermost in order to work correctly.