Unable to download build artifact via web request

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs 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

When using wget to download a build artifact via a web request with HTTP Basic Authentication and Anonymous access disabled in Bamboo, an error occurs and the downloaded file is corrupted. However, when manually entering the username and password in the Web interface, the artifact is downloaded correctly.

Environment

  • Any Bamboo version

  • wget

Diagnosis

While fetching a build artifact from Bamboo via a web request using wget:

1 $ wget --user user --password <PASSWORD> -N <bamboo-artifact-url>

The following error is present in theatlassian-bamboo.log file:

1 2023-03-07 17:16:06,658 ERROR [http-nio-8085-exec-1] [AbstractDownloadStrategy] Access denied for downloads URL /<bamboo-artifact-url>

The location of the atlassian-bamboo.log file can be viewed in Bamboo's System information under the Bamboo paths section

1 2 3 4 5 6 7 8 9 10 11 [root@xxx:~]# wget -N <bamboo-artifact-url> {-}{{-}}<date-time>{{-}}{-} <bamboo-artifact-url> Resolving <bamboo-url> (bamboo-url)... <bamboo-ip> Connecting to <bamboo-url> (<bamboo-url>)|<bamboo-ip>|:443... connected. HTTP request sent, awaiting response... 302 Location: <bamboo-artifact-url> [following] {-}{{-}}<date-time>{{-}}{-} <bamboo-artifact-url> Reusing existing connection to <bamboo-url>:443. HTTP request sent, awaiting response... 200 Length: unspecified [text/html] Saving to: '<artifact-name>'

Cause

This happens because Bamboo does not send HTTP request authentication challenges back to the client when an Artifact URL is requested.

Solution

Option 1: Use the --auth-no-challenge argument with wget. Since wget 1.10.2, Basic HTTP authenticationis only sent when the target HTTP server responds with an authentication challenge. By using the '--auth-no-challenge' parameter, wget will send Basic HTTP authentication information (plaintext username and password) for all requests.

1 $ wget --auth-no-challenge --http-user <user> --http-password <password> <bamboo-artifact-url>

Option 2: Use curl and follow redirects. curl sends Basic HTTP authentication challenges to all requests by default when a username is provided. Make sure to follow redirects by setting the --location or -L arguments:

1 $ curl --location --user <user>:<password> <bamboo-artifact-url> -o artifact.txt
Updated on March 4, 2025

Still need help?

The Atlassian Community is here for you.