# Gitlab and mattermost separate server setup

**URL:** <https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459>\
**Category:** Troubleshooting\
**Created:** [May 7, 2016, 6:01pm UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459 "2016-05-07T18:01:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![fircx](https://avatars.discourse-cdn.com/v4/letter/f/d07c76/32.png) [@fircx](https://forum.mattermost.com/u/fircx)\
**Post date:** [May 7, 2016, 6:01pm UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459/1 "2016-05-07T18:01:46Z")

</div>

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.

 ![](https://us1.discourse-cdn.com/flex020/uploads/mattermost/original/1X/3e26298b72125bb20be7961293664d32ca25abba.png)

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](http://mattermost.url)’

# Tell GitLab Mattermost to integrate with [gitlab.example.com](http://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](http://gitlab/oauth/authorize)”  
mattermost[‘gitlab\_token\_endpoint’] = “[http://gitlab/oauth/token](http://gitlab/oauth/token)”  
mattermost[‘gitlab\_user\_api\_endpoint’] = “[http://gitlab/api/v3/user](http://gitlab/api/v3/user)”

# Shut down GitLab services on the Mattermost server

gitlab\_rails[‘enable’] = false  
`

---

<div class="post-metadata">

**Author:** ![jwilander](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/jwilander/32/8440_2.png) [@jwilander](https://forum.mattermost.com/u/jwilander)\
**Post date:** [May 10, 2016, 2:01pm UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459/2 "2016-05-10T14:01:11Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fircx](https://avatars.discourse-cdn.com/v4/letter/f/d07c76/32.png) [@fircx](https://forum.mattermost.com/u/fircx)\
**Post date:** [May 13, 2016, 9:32am UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459/3 "2016-05-13T09:32:51Z")

</div>

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](https://www.diffchecker.com/uz4cds5r)

---

<div class="post-metadata">

**Author:** ![jwilander](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mattermost.com/jwilander/32/8440_2.png) [@jwilander](https://forum.mattermost.com/u/jwilander)\
**Post date:** [May 13, 2016, 12:30pm UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459/4 "2016-05-13T12:30:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![fircx](https://avatars.discourse-cdn.com/v4/letter/f/d07c76/32.png) [@fircx](https://forum.mattermost.com/u/fircx)\
**Post date:** [May 13, 2016, 12:46pm UTC](https://forum.mattermost.com/t/gitlab-and-mattermost-separate-server-setup/1459/5 "2016-05-13T12:46:40Z")

</div>

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
