Issue Summary
Bamboo Remote Agent fails with NPE when used Apache Reverse Proxy in front of Bamboo
This is reproducible on Data Center: ![]()
Steps to Reproduce
- Install Bamboo and a Remote Agent
- Set an Apache HTTPD version 2.4.59 or later and set it as a Reverse Proxy in front of the Bamboo Server
- Start the Agent
- Monitor the logs
Expected Results
The Bamboo Agent should be able to connect to the Bamboo Server normally. Or provide an error message that would indicate what's wrong.
Actual Results
The Bamboo Agent fails to connect to the Bamboo Server reporting a NullPointerException (NPE) without any meaningful explanation
STATUS | wrapper | 2024/12/10 15:54:15 | --> Wrapper Started as Daemon STATUS | wrapper | 2024/12/10 15:54:15 | Java Service Wrapper Standard Edition 64-bit 3.5.51 STATUS | wrapper | 2024/12/10 15:54:15 | Copyright (C) 1999-2022 Tanuki Software, Ltd. All Rights Reserved. STATUS | wrapper | 2024/12/10 15:54:15 | http://wrapper.tanukisoftware.com STATUS | wrapper | 2024/12/10 15:54:15 | Licensed to Atlassian Pty Ltd for Bamboo Remote Agent STATUS | wrapper | 2024/12/10 15:54:15 | INFO | jvm ver. | 2024/12/10 15:54:15 | openjdk version "11.0.14.1" 2022-02-08 INFO | jvm ver. | 2024/12/10 15:54:15 | OpenJDK Runtime Environment Temurin-11.0.14.1+1 (build 11.0.14.1+1) INFO | jvm ver. | 2024/12/10 15:54:15 | OpenJDK 64-Bit Server VM Temurin-11.0.14.1+1 (build 11.0.14.1+1, mixed mode) STATUS | wrapper | 2024/12/10 15:54:15 | Launching a JVM... INFO | jvm 1 | 2024/12/10 15:54:16 | WrapperManager: Initializing... INFO | jvm 1 | 2024/12/10 15:54:16 | 2024-12-10 15:54:16,970 INFO [WrapperSimpleAppMain] [AgentBootstrap] Starting Agent Bootstrap using Java 11.0.14.1 from Eclipse Adoptium. Default charset: UTF-8, file name encoding: UTF-8 INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp: INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: Encountered an error running main: INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: java.lang.reflect.InvocationTargetException INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/java.lang.reflect.Method.invoke(Method.java:566) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at com.atlassian.bamboo.agent.bootstrap.AgentBootstrap.main(AgentBootstrap.java:21) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/java.lang.reflect.Method.invoke(Method.java:566) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at org.tanukisoftware.wrapper.WrapperSimpleApp.run(WrapperSimpleApp.java:349) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at java.base/java.lang.Thread.run(Thread.java:829) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: Caused by: java.lang.NullPointerException INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.getFinalUrlWithRedirects(RemoteAgentBootstrap.java:294) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.getBambooUrl(RemoteAgentBootstrap.java:344) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: at com.atlassian.bamboo.agent.bootstrap.RemoteAgentBootstrap.main(RemoteAgentBootstrap.java:71) INFO | jvm 1 | 2024/12/10 15:54:17 | WrapperSimpleApp Error: ... 11 more STATUS | wrapper | 2024/12/10 15:54:19 | on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Workaround
This is an external issue caused by a recent change to the Apache HTTPD product, which will remove the "Content-Length" header to mitigate a security issue. Such a header is required by the Bamboo Agent to validate the connection to the Server.
- https://cweiske.de/tagebuch/content-length-header-missing.htm
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=2024-24795
- Bug 68973 - Content-Length header missing in 2.4.59 is a breaking change
Configure Apache to restore the Content-Length header:
Add the following configuration to the Apache VirtualHost that hosts Bamboo and restart the HTTPD service.
SetEnv ap_trust_cgilike_cl 1
Please check the Apache HTTPD documentation page for further instructions.