Gitlab and mattermost separate server setup

Hey guys.
I don’t remember from which version I started using gitlab but mattermost wasn’t not included back than, so I decided to install new gitlab omnibus on a different server and than integrate with my existing gitlab. I did and It works fine, but when I try authorize mattermost I get 404 from gitlab.

this is the error:

Started POST "/oauth/authorize" for 127.0.0.1 at 2016-05-07 21:51:24 +0400 Processing by Oauth::AuthorizationsController#create as HTML Parameters: {"utf8"=>"✓", "authenticity_token"=>"[FILTERED]", "client_id"=>"84c196d399b550d69ff147bb424a287f665768c6e4a6f6cd2f96cdf7815d9146", "redirect_uri"=>"http://url/signup/gitlab/complete", "state"=>"eyJhY3Rpb24iOiJzaWdudXAiLCJoYXNoIjoiJDJhJDEwJGFKdlp3Z3Bpdi5GdndtU1ZxSXhpdHVFMGV2SzhCbzBwVzVGeTJFQzhLSXVyQ21ZZU1KeWI2IiwidGVhbSI6InFhcnZhMDEyMzQ1Njc4OTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNyJ9", "response_type"=>"code", "scope"=>"api", "commit"=>"Authorize"} Redirected to http://url/signup/gitlab/complete?code=2b47d406beec1cca4332a9611a148be53a3662f2e411392ae608642ee03c46e5&state=eyJhY3Rpb24iOiJzaWdudXAiLCJoYXNoIjoiJDJhJDEwJGFKdlp3Z3Bpdi5GdndtU1ZxSXhpdHVFMGV2SzhCbzBwVzVGeTJFQzhLSXVyQ21ZZU1KeWI2IiwidGVhbSI6InFhcnZhMDEyMzQ1Njc4OTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNyJ9 Completed 302 Found in 77ms (ActiveRecord: 67.0ms) Started GET "/signup/gitlab/complete?code=[FILTERED]&state=eyJhY3Rpb24iOiJzaWdudXAiLCJoYXNoIjoiJDJhJDEwJGFKdlp3Z3Bpdi5GdndtU1ZxSXhpdHVFMGV2SzhCbzBwVzVGeTJFQzhLSXVyQ21ZZU1KeWI2IiwidGVhbSI6InFhcnZhMDEyMzQ1Njc4OTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNyJ9" for 127.0.0.1 at 2016-05-07 21:51:24 +0400 Processing by NamespacesController#show as HTML Parameters: {"code"=>"[FILTERED]", "state"=>"eyJhY3Rpb24iOiJzaWdudXAiLCJoYXNoIjoiJDJhJDEwJGFKdlp3Z3Bpdi5GdndtU1ZxSXhpdHVFMGV2SzhCbzBwVzVGeTJFQzhLSXVyQ21ZZU1KeWI2IiwidGVhbSI6InFhcnZhMDEyMzQ1Njc4OTEwMTExMjEzMTQxNTE2MTcxODE5MjAyMTIyMjMyNDI1MjYyNyJ9", "id"=>"signup/gitlab/complete"} Completed 404 Not Found in 48ms (Views: 0.9ms | ActiveRecord: 2.4ms)
Gitlab version is 8.7.0 and mattermost gitlab 8.7.3

this is mattermost config:

`mattermost_external_url ‘http://mattermost.url

Tell GitLab Mattermost to integrate with gitlab.example.com

mattermost[‘gitlab_enable’] = true
mattermost[‘gitlab_secret’] = “secret”
mattermost[‘gitlab_id’] = “id”
mattermost[‘gitlab_scope’] = “”
mattermost[‘gitlab_auth_endpoint’] = “http://gitlab/oauth/authorize
mattermost[‘gitlab_token_endpoint’] = “http://gitlab/oauth/token
mattermost[‘gitlab_user_api_endpoint’] = “http://gitlab/api/v3/user

Shut down GitLab services on the Mattermost server

gitlab_rails[‘enable’] = false
`

Hi @fircx,

It looks like one of your redirect URLs might be setup incorrectly. In GitLab can you go to Admin Area -> Applications and see what is under Callback URL for Mattermost? The domain for each callback URL should be your Mattermost domain.

Hey,
Thanks for your replay actually URLs are setup correctly, as I mentioned I have another instance of gitlab and mattermost works there. I compared all configs between two servers and everything is same expect on old gitlab (production server where we have all projects and active user) oauth request gets handled by NamespacesController. As I understand it must be handled by doorkeeper.
this is a production.log of two gitlab servers left is old one which doesn’t work and right is newer which works perfect.

https://www.diffchecker.com/uz4cds5r

Did you manually sanitize this part http://url/signup/gitlab/complete in the left log? It looks like GitLab has the wrong (or no) URL and is making the request to itself (see the GET that started and 404ed) rather than to Mattermost.

Yes I did that for privacy purpose, but forgot the to remove test gitlab domain anyways it’s just a fake TLD wont resolve outside private network