--昨夜西风凋碧树,独上高楼,望尽天涯路
问题:
当配置好Webhook url时候执行push test的时候报错:
Hook executed successfully but returned HTTP 403<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <title>Error 403 No valid crumb was included in the request</title> </head> <body><h2>HTTP ERROR 403</h2> <p>Problem accessing /job/eureka-service/build. Reason: <pre> No valid crumb was included in the request</pre></p><hr><a href="http://eclipse.org/jetty">Powered by Jetty:// 9.4.z-SNAPSHOT</a><hr/> </body> </html>
原因:
由于Jenkins的安全策略配置了CSRF跨站点保护。
解决方案:
进入Jenkins,系统管理-->全局安全配置,勾选匿名用户具有可读权限和去掉CSRF防止跨站点请求伪造:
再次测试,成功触发: