Bitbucket can not trigger a jenkins job when I used Bitbucket Push and Pull Request plugin
Asked by Tingting_Zhou:

I have a cloud bitbucket, and I configure the webhook like this as below:

![bitbucket-webhook.png](https://community.atlassian.com/t5/image/serverpage/image-id/255618iF047DA0093EC99B7/image-size/large?v=v2&px=999 "bitbucket-webhook.png")

Then I installed "Bitbucket Push and Pull Request" plugin on my Jenkins, and configure the info as below:

The plugin URL: <https://plugins.jenkins.io/bitbucket-push-and-pull-request>

The global configure in jenkins: (Path: Manage Jenkins --\> configure system)

![jenkins-configure-system.png](https://community.atlassian.com/t5/image/serverpage/image-id/255621i46696A47EFF54F88/image-size/large?v=v2&px=999 "jenkins-configure-system.png")

The configuration in jenkins job: (Credentials used username and app password with bitbucket)

![jenkins-build-trigger-config.png](https://community.atlassian.com/t5/image/serverpage/image-id/255620iDD19B80572E303DB/image-size/large?v=v2&px=999 "jenkins-build-trigger-config.png")

When I created a pull request on bitbucket, I saw the error in the webhook log:

\<!doctype html\>\<html lang="en"\>\<head\>\<title\>HTTP Status 403 -- Forbidden\</title\>\<style type="text/css"\>body {font-family:Tahoma,Arial,sans-serif;} h1, h2, h3, b {color:white;background-color:#525D76;} h1 {font-size:22px;} h2 {font-size:16px;} h3 {font-size:14px;} p {font-size:12px;} a {color:black;} .line {height:1px;background-color:#525D76;border:none;}\</style\>\</head\>\<body\>\<h1\>**HTTP Status****403** **-- Forbidden**\</h1\>\<hr class="line" /\>\<p\>\<b\>Type\</b\> **Status Report** \</p\>\<p\>\<b\>Message\</b\> **No valid crumb was included in the request** \</p\>\<p\>\<b\>Description\</b\> **The server understood the request but refuses to authorize it.**\</p\>\<hr class="line" /\>\<h3\>Apache Tomcat/9.0.74\</h3\>\</body\>\</html\>

Who can tell me where the configuration error caused this error?


Answers:
author: Theodora Boudale
body: Hi [@Tingting_Zhou](/t5/user/viewprofilepage/user-id/5212828) and welcome to the community!

Based on the error **"No valid crumb was included in the request"** , it sounds like you most likely have enabled the option **Prevent Cross Site Request Forgery exploits** in Jenkins.

What is expected then is for Atlassian to include a header with the API upload  
"Jenkins-Crumb: 0db38413bd7ec9e98974f5213f7ead8b", but we cannot include that with the webhook payload, so the request fails.

What you could do is use a proxy that will receive the traffic from Bitbucket and forward it to Jenkins, so that it includes the crumb in a custom header. You would need to enable the option **Enable proxy compatibility** in the CSRF Protection settings in Jenkins. You can check this StackOverflow post: <https://stackoverflow.com/a/56167349>

Another option would be to disable **Prevent Cross Site Request Forgery exploits** in Jenkins, but that would make you vulnerable to CSRF attacks.

Kind regards,  
Theodora

comments: author: Pratima Maiti
body: I have enabled **Enable proxy compatibility** as mentioned in that stackoverflow post along with same configuration mentioned by [@Tingting_Zhou](/t5/user/viewprofilepage/user-id/5212828) . But it's still giving the same issue.

Could you tell me what's wrong?


author: Theodora Boudale
body: Hi Pratima,

You will also need to configure your proxy to include the crumb in a custom header in traffic it receives from Bitbucket Cloud before it forwards it to Jenkins. What the error means is that Jenkins does not receive this crumb.

Kind regards,  
Theodora


Tags: bitbucket-cloud

cloud

jenkins

webhook