The redirect URI included is not valid while redirected to Gitlab

Summary

We have hosted mattermost server and gitlab server on same VM, we are using gitlab sso which is integrated with our ldap.
Later we have decided go mattermost on internet and assigned the VM public IP (corporate proxy server). it has been accessed with http://IP:8065
and gitlab is also accessible over internet http://IP.
We can able to redirect from mattermost to gitlab , authentication is also happening with ldap, but when its been authenticated it says

The redirect URI included is not valid while

Steps to reproduce

Both Gitlab and mattermost are hosted over public ip.

Below are the config.json

http://internetIP
http://internetIP/api/4/user
http://internetIP/oauth/authorize
http://internetIP/outh/token

Gitlab config is
http://internetIP:8065/login/gitlab/complete/
http://InternetIP:8065/signup/gitlab/complete/

Expected behavior

Mattermost should go to gitlab authenticate and redirect to mattermost again

Observed behavior

Gitlab does not redirect back to mattermost after authentication.

from the gitlab i found out.

Processing by ApplicationController#route_not_found as /
Parameters: {“unmatched_route”=>“oauth/undefined”}
Completed 404 Not Found in 18ms

Thanks in Advance

Hi @bharat8657, what Mattermost and Gitlab versions are you on?

Mattermost is Version: 5.8.0
and Gitlab is 11.11.2

Hi @bharat8657,

Would you be able to post the full log errors that you see?

Also wondering if these earlier threads might help: