Configuring Bitbucket Server Webhook to Jenkins results in Unknown Host response 504
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
Setting Bitbucket Server Webhook to Jenkins results in an error when running the "Trigger" Jenkins test. The following appears in the UI:
Error: Jenkins response: <HEAD><TITLE>Unknown Host</TITLE></HEAD> <BODY BGCOLOR="white" FGCOLOR="black"><H1>Unknown Host</H1><HR> <FONT FACE="Helvetica,Arial"><B> Description: Unable to locate the server named "<em>illin3305</em>" — the server does not have a DNS entry. Perhaps there is a misspelling in the server name, or the server no longer exists. Double-check the name and try again.</B></FONT> <HR> <!-- default "Unknown Host" response (504) --> </BODY>
The following is displayed on the atlassian-bitbucket.log
:
2016-02-10 11:35:48,452 INFO [WebHookProcessor:thread-1] ausername @74KRR2x695x264x0 1km74r 127.0.0.1 SSH - git-receive-pack '/gttoj/mygittestproject.git' c.a.b.p.h.i.RequestFactoryWebHookProcessorWorker Invalid response from hook 'http://yourjenkins.com:42500/jenkins/bitbucket-hook/', repository ID '1', status: '504' / 'Unknown Host'
The host above can be pinged from the machine hosting Bitbucket Server, though.
Diagnosis
Environment
Check your JVM for outbound proxy configuration. Are there any parameters like the one below configured?
-Dhttp.proxyUser -Dhttp.proxyPassword -Dhttp.proxyHost -Dhttp.proxyPort
Diagnostic Steps
- pinging the address from the server hosting Bitbucket is an excellent clue to see if the domain can be resolved thus confirming the outbound proxy is playing a role here.
Cause
JVM parameter for outbound proxy configuration could be causing this issue.
Resolution
In order to fix this, please configure a parameter to stop requests from the application from going through the Outbound proxy.
You could configure a variable:
-Dhttp.nonProxyHosts=yourjenkins.com
Please refer to How to configure an outbound HTTP and HTTPS proxy for Bitbucket Server for more details on this.