19

I am trying to configure the web hook on GitHub so that it can send the POST to http://127.0.0.1:8080/github-webhook/

My Jenkins is running on http://127.0.0.1:8080

And here is my GitHub web hook configuration: enter image description here

And I get the following error:
enter image description here

My Jenkins is running for sure on http://127.0.0.1:8080/. So, that is not a problem for sure.

2 Answers 2

12

GitHub would not know how to contact "localhost" or 127.0.0.1: what GitHub would consider "localhost" would be one of their local machines / containers.

You need to specify an external IP address GitHub can contact over the internet. Not just "localhost".

That means your PC must expose to the internet the port 8080.
That can involve opening said port on your router for instance.
Or, at work, requesting from your IT department a firewall rule to allow traffic on that port.

0
12

If you want to try to run Jenkins on localhost, the other way around is that, install ngrok: https://ngrok.com/download which expose localhost urls over internet. After installation of the ngrok run it e.g

./ngrok http 8080

It will give you a url like this: http://3b2db437.ngrok.io

Now under payloadUrl: type the url as:

http://3b2db437.ngrok.io:8080/github-webhook/

Now the localhost Jenkins setup would run and the payload error would be gone.

Note: In above URL, you mentioned 8080 again. Since the url generated on ngrok already contains this, adding it again would result in service timeout error : "We couldn’t deliver this payload: Service Timeout".

To avoid this, you want to edit your webhook as (removing :8080) " http://3b2db437.ngrok.io/github-webhook/

This solved the problem.

Also a tip for end users: I forgot to add a trailing forward slash after github-webhook/, which caused issues for me. I saw others also doing the same mistake and found answers on StackOverflow. Maybe something to be careful about.

1
  • On my win 10 machine, I tried to run ./ngrok http 8080 using git bash but it always got stuck and was unresponsive. However, running the same command ngrok http 8080 on window cmd works fine. Not sure if it's related to win 10 firewall issue. Commented Oct 26, 2019 at 5:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.