# Drone and Gitlab

**URL:** <https://drone.discourse.group/t/drone-and-gitlab/8317>\
**Category:** Drone Support\
**Created:** [March 24, 2019, 2:07pm UTC](https://drone.discourse.group/t/drone-and-gitlab/8317 "2019-03-24T14:07:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![codyja](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@codyja](https://drone.discourse.group/u/codyja)\
**Post date:** [March 24, 2019, 2:07pm UTC](https://drone.discourse.group/t/drone-and-gitlab/8317/1 "2019-03-24T14:07:46Z")

</div>

Hi All,  
Running drone 1.0.0 trying to connect to gitlab repos. Do have permissions to repo, and pointing to gitlab’s https address, can confirm no redirects or such. Drone is giving me:  
`"msg":"api: cannot create or update hook"`

Gitlab is giving me :

```auto
==> production.log <== 
Started GET "/api/v4/projects/codyja%2Ftest-project/hooks?per_page=100" for 127.0.0.1 at 2019-03-24 08:32:43 -0500 
Started POST "/api/v4/projects/codyja%2Ftest-project/hooks?merge_requests_events=true&push_events=true&tag_push_events=true&token=[FILTERED]&url=https%3A%2F%2Fdrone.domain.local%2Fhook" for 127.0.0.1 at 2019-03-24 08:32:43 -0500

```

In the API call to gitlab it has two IPs: `"ip":"10.0.4.75, 127.0.0.1"`, how can I get rid of that 127.0.0.1 in that call from drone? I have DRONE\_SERVER\_HOST set to my host’s fqdn

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 24, 2019, 6:30pm UTC](https://drone.discourse.group/t/drone-and-gitlab/8317/2 "2019-03-24T18:30:19Z")

</div>

Drone is using the value of DRONE\_SERVER\_HOST in the request:

“/api/v4/projects/codyja%2Ftest-project/hooks?merge\_requests\_events=true&push\_events=true&tag\_push\_events=true&token=[FILTERED]& **url=https%3A%2F%2Fdrone.domain.local%2Fhook** ”

The `for 127.0.0.1` likely refers to the source IP address that sent the http Request to GitLab. If you install Drone and GitLab on the same machine, or you have a reverse proxy in front of GitLab, this would be expected.

---

<div class="post-metadata">

**Author:** ![codyja](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@codyja](https://drone.discourse.group/u/codyja)\
**Post date:** [March 25, 2019, 4:00am UTC](https://drone.discourse.group/t/drone-and-gitlab/8317/3 "2019-03-25T04:00:40Z")

</div>

They’re two separate machines. In that call to gitlab theres two IPs listed for some reason.

---

<div class="post-metadata">

**Author:** ![codyja](https://avatars.discourse-cdn.com/v4/letter/c/ce7236/32.png) [@codyja](https://drone.discourse.group/u/codyja)\
**Post date:** [March 25, 2019, 1:11pm UTC](https://drone.discourse.group/t/drone-and-gitlab/8317/4 "2019-03-25T13:11:09Z")

</div>

Here’s an example of the gitlab api\_json.log (note the two IPs listed in the “IP” field):

```auto
==> api_json.log <==
{"time":"2019-03-24T15:38:02.427Z","severity":"INFO","duration":17.79,"db":3.8,"view":13.989999999999998,"status":200,"method":"GET","path":"/api/v4/projects/codyja%2Ftest-project/hooks","params":[{"key":"per_page","value":"100"}],"host":"buildserver.domain.local","ip":"10.0.4.74, 127.0.0.1","ua":"Go-http-client/1.1","route":"/api/:version/projects/:id/hooks","user_id":2,"username":"codyja","queue_duration":13.53,"gitaly_calls":0,"correlation_id":"PW6bP12GSZ"}
{"time":"2019-03-24T15:38:02.573Z","severity":"INFO","duration":114.34,"db":6.61,"view":107.73,"status":422,"method":"POST","path":"/api/v4/projects/codyja%2Ftest-project/hooks","params":[{"key":"merge_requests_events","value":"true"},{"key":"push_events","value":"true"},{"key":"tag_push_events","value":"true"},{"key":"token","value":"[FILTERED]"},{"key":"url","value":"https://drone.domain.local/hook"}],"host":"buildserver.domain.local","ip":"10.0.4.74, 127.0.0.1","ua":"Go-http-client/1.1","route":"/api/:version/projects/:id/hooks","user_id":2,"username":"codyja","queue_duration":28.63,"gitaly_calls":0,"correlation_id":"sytXHDB9fv"}

```

---

<div class="post-metadata">

**Author:** ![bradrydzewski](https://yyz1.discourse-cdn.com/flex003/user_avatar/drone.discourse.group/bradrydzewski/32/3513_2.png) [@bradrydzewski](https://drone.discourse.group/u/bradrydzewski)\
**Post date:** [March 25, 2019, 3:25pm UTC](https://drone.discourse.group/t/drone-and-gitlab/8317/5 "2019-03-25T15:25:58Z")

</div>

I recommend contacting GitLab support. The IP address field is not something populated by Drone. GitLab is logging metadata from the http request and underlying tcp connection. Also, I do not see any correlation between the IP address and the request failing. Can you share why you think this is the root cause?
