【问题标题】:Github Webhook With Jenkins return 302 FoundGithub Webhook 与 Jenkins 返回 302 Found
【发布时间】:2018-09-25 16:41:56
【问题描述】:

我设置了 localhost jenkins,使用 ngrok 将我的 jenkins 公开到 github。 我没有设置任何凭据。 当我从 webhook 测试交付时,它显示 302 not found。 回应:

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

【问题讨论】:

    标签: jenkins github jenkins-pipeline ngrok git-webhooks


    【解决方案1】:

    刚刚遇到同样的问题。看来您正在使用以下网址: http://056b05cb.ngrok.io/github-webhook

    只需将其切换为http://056b05cb.ngrok.io/github-webhook/(注意尾随/

    如果您在浏览器上点击没有 / 的 url,它将得到 302 并且浏览器将简单地重定向。但是 webhook 不遵循重定向,因此它只是告诉您响应是什么,即 302 重定向。

    【讨论】:

    • 这正是我的问题!谢谢!
    • 天哪,真是个讨厌的家伙。谢谢你。我挠了挠头
    • 感谢您的指出!希望它在 jenkins/github 集成方面得到更好的记录!
    • 该死的。我要去的指南也有斜线。我:不,我不需要它。嗯。
    • 谢天谢地,在我花了几个小时试图解决这个问题之前,我找到了这个答案!
    【解决方案2】:

    请使用 https://domain/github-webhook/ 编辑您的钩子 jenkins

    注意最后一个网址中的尾随 /

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-04-14
      • 2022-07-16
      • 2015-12-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-09-15
      • 2019-09-03
      相关资源
      最近更新 更多