The redirect URI included is not valid with proxy_pass
For defects with GitLab Mattermost other than installation that can be reproduced (e.g. issues with GitLab SSO, GitLab webhook integration, etc.), please help share details of the defect in the following format:
Summary
When using a proxy_pass with NGINX for Mattermost SSO returns The redirect URI included is not valid.
Steps to reproduce
Two hosts in configuration:
- Host 1 = Nginx Proxy (DMZ)
- Host 2 = Gitlab-ee / mattermost
Env:
- OS: Ubuntu 14.04.5 LTS
- nginx version: nginx/1.8.0
Add a proxy_pass to the NGINX in front of Mattermost and it should be enough to replicate this behavior.
Expected behavior
After reaching Mattermost and pressing on the sign in through GitLab button OAuth should authenticate and redirect us to the chat screen.
Observed behavior
After pressing the GitLab sign in button the result spit out was The redirect URI included is not valid. The tailed logs showed that the redirect uri which was being used had an additional /before signup.
Possible fixes
Adding an addition /to the OAuth Redirect URI before signup allowed SSO to work. It seems that there is an additional /added when using the proxy pass and not considered at https://github.com/mattermost/platform/blob/master/api/oauth.go#L295
/cc @stanhu