Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in DevOps and Agile by (29.3k points)

I set up a localhost Jenkins, using ngrok to expose my Jenkins to github. I didn't set up any credentials. When I test delivery from webhook, it shows 302 not found. Response:

Content-Length: 0

Date: Mon, 16 Apr 2018 02:09:22 GMT

Location: http://056b05cb.ngrok.io/github-webhook/

Server: Jetty(9.4.z-SNAPSHOT)

X-Content-Type-Options: nosniff

Request:

Headers

Request URL: http://056b05cb.ngrok.io/github-webhook

Request method: POST

content-type: application/json

Expect: 

User-Agent: GitHub-Hookshot/d5b13bc

X-GitHub-Delivery: bdc31e52-4115-11e8-9e6b-c7d083151290

X-GitHub-Event: push

Payload

{

  "ref": "refs/heads/master",

  "before": "14e1265dc10ef64c93ee7791db7fa9ccef63279f",

  "after": "1f51b991d10af7c2b8fb4bc4c44417a57cf7bb56",

  "created": false,

  "deleted": false,

  "forced": false,

  "base_ref": null,

  .....

}

1 Answer

+1 vote
by (50.2k points)

For this issue, you need to add a '/' at the end of the url If you hit the url without the '/' on a browser, it will get a 302 and the browser will simply redirect. But the webhook does not follow redirects, so it simply tells you what the response was, which was a 302 redirect.

so to resolve this you need to use a '/' at the end of your url.

example:

<url>/git-webhook is you present url then you need to run it as <url>/git-webhook/

This will resolve your issue.

Browse Categories

...