Github Webhook With Jenkins return 302 Found

pinkon5k  于 12个月前  发布在  Jenkins
关注(0)|答案(3)|浏览(148)

我设置了本地主机jenkins,使用ngrok将我的jenkins暴露给github。我没有设置任何凭证。当我测试webhook的交付时,它显示302未找到。回应:

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

要求:

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,
  .....
}
czq61nw1

czq61nw11#

刚刚被同样的问题击中。您似乎正在使用URL:http://056b05cb.ngrok.io/github-webhook
只需将其切换为http://056b05cb.ngrok.io/github-webhook/(注意尾部的/
如果你在浏览器上点击没有/的网址,它会得到302,浏览器会简单地重定向。但是webhook不跟随重定向,所以它只是告诉你响应是什么,这是一个302重定向。

mutmk8jj

mutmk8jj2#

请使用https://domain/github-webhook/编辑你的钩子jenkins
注意最后一个URL中的/

qlzsbp2j

qlzsbp2j3#

由于“/”,它将抛出HTTP状态代码302错误,请删除旧的Web挂钩,并添加新的“/”
示例:http://3.131.67.206:8080/github-webhook/

相关问题