Mattermost generates wrong redirect uri for GitLab SSO authentication

Description

Signing-in into Mattermost through GitLab doesn't work if Mattermost is behind a reverse proxy and this proxy communicates with HTTP with Mattermost while the user is facing the page with HTTPS (because the proxy support SSL).

See: https://github.com/mattermost/platform/issues/3944

Repro:
1. Run Mattermost behind a reverse proxy,
2. let the proxy communicate with Mattermost via HTTP,
3. configure the proxy to support HTTPS for the user,
4. enable SSO with GitLab,
5. finally: try to log-in

Expected behavior

After clicking the SSO button on Mattermost, it will redirect me to GitLab where I have to login-in and authorize the Application to use my account data. After authorizing GitLab should redirect me to Mattermost where I'm logged in now.

Observed behavior

After clicking the SSO button GitLab will fail (with the error message: The redirect URI included is not valid.) due to the fact, that the redirect_uri query param doesn't match the provided client_id.

QA Test Steps

None

Status

Mana

None

Assignee

Linda Mitchell

QA Assignee

None

Reporter

Lindsay Brock

Epic Link

None

Fix versions

None

Mattermost Team

None

Sprint

None

Labels

None

QA Testing Areas

None

GitHub Issue

None

Components

None
Configure