How to bypass the Reverse Proxy used by a Bamboo Server in an Agent connection
Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.
Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. 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
Summary
This article covers possible solutions to overcome Agent communication problems while transferring Artifacts to and from the Bamboo server.
If you are attempting this in order to fix artifact transfer problems (rejections, timeouts, etc.). Make sure the Proxy server supports HTTP/1.1: Agent upload of artifacts fails to set Content-Length in HTTP/1.1. Guiding questions:
- Is HTTP/1.0 compatibility turned on?
- Are there any configuration options turned on related to chunked transfer encoding?
Environment
- Bamboo Server or Data Center
- Remote or Elastic Agent
- Artifact transfers from and to the Bamboo instance
Diagnosis
The Bamboo Server and Remote Agents may report issues while transferring Artifacts when a Load Balancer or Reverse Proxy is configured between both elements. Though Load Balancers are normally welcome on Bamboo setups, there may be cases where they may interfere with proper traffic and end up creating issues such as the reported error below on a Bamboo Agent logs at <Bamboo-Agent-Home>/atlassian-bamboo-agent.log
.
INFO | jvm 1364 | 2024/10/14 10:00:33 | 2024-10-14 10:00:33,728 INFO [0-BAM::RemoteAgent-80139::Agent:pool-4-thread-1] [TaskExecutorImpl] Starting task 'Download release contents' of type 'com.atlassian.bamboo.plugins.bamboo-artifact-downloader-plugin:artifactdownloadertask'
.................................
INFO | jvm 1364 | 2024/10/14 10:05:39 | java.net.SocketException: Connection reset
INFO | jvm 1364 | 2024/10/14 10:05:39 | at java.net.SocketInputStream.read(SocketInputStream.java:186) ~[?:?]
Bamboo Elastic Agents may encounter issues when the Bamboo URL resolves to an IP address different from the one hosted on the Bamboo Server machine. This occurs because Bamboo establishes a tunnel to the Elastic Agent, which then attempts to connect back to the Bamboo Server using that URL. If the URL resolves to an external IP address, the server may try to connect to that location using external routes, leading to instability or failed connections. This phenomenon is better explained by this KB article:
Solution
Remote Agents
- Stop Bamboo
- Edit the
<Bamboo-Install>/conf/server.xml
file - Add a new HTTP connector without the attributes (proxyName and proxyPort) pointing to a different port
- Start Bamboo
Stop the Remote Agent
Update the <URL:PORT> used by your Agent to match new connector added. On your
<Bamboo-Agent-Home>/conf/wrapper.conf
, modify thewrapper.app.parameter.2
property to point to the Bamboo proxy-bypass URL and port.- Restart the agent
Elastic Agents
- Stop Bamboo
Add the following system property in your Bamboo startup JVM (more details on Configuring your system properties)
setenv.sh-Dbamboo.ec2.agent.endpoint=http://localhost:8085
Make sure to replace port 8085 with the Tomcat port configured in your Bamboo instance.
You may need to updatebamboo.jms.broker.client.uri
to match the non-proxied URL.- Start Bamboo
- Start a new Elastic Agent