Skip to content

Bad request after redirect #382

@diederikfaber

Description

@diederikfaber

Describe the bug

During a CI/CD script (jetbrains space automation) one of the steps in a gradle build is to download a .jar file. The response to the initial GET is a 307 temporary redirect with a new location specified in the Location header of the response. When the redirect is followed, a 400 Bad request is returned and the build obviously fails.

Manually downloading the file from this redirect location works, so the location itself is valid. We're using bearer tokens for authentication and these are also verified correct (and we don't get a 401).

Sample build script

I can't create a build script that fails continuously. Even our gradle build works in different automation configurations, the only difference (as far as I can tell) being the location returned in the redirect (I don't understand why that is, but ok).

I do have an excerpt from a gradle build log with debugging enabled.

I realize this is not a lot to go on, but hopefully this issue rings a bell somewhere.

Build log excerpt

[11:39:34] 2024-02-09T11:39:33.796+0000 [DEBUG] [de.undercouch.gradle.tasks.download.internal.DebugInterceptor] Sending request:
[11:39:34] > GET /my/file/location/blablabla/lib.jar
[11:39:34] > Authorization: Bearer *******
[11:39:34] > Accept-Encoding: gzip, x-gzip, deflate
[11:39:34] 2024-02-09T11:39:33.904+0000 [DEBUG] [de.undercouch.gradle.tasks.download.internal.DebugInterceptor] Received response:
[11:39:34] < HTTP/1.1 307 Temporary Redirect
[11:39:34] < Date: Fri, 09 Feb 2024 11:39:33 GMT
[11:39:34] < Content-Length: 0
[11:39:34] < Connection: keep-alive
[11:39:34] < Vary: Origin
[11:39:34] < X-Frame-Options: DENY
[11:39:34] < Content-Security-Policy: frame-ancestors 'none'
[11:39:34] < Referrer-Policy: no-referrer
[11:39:34] < Location: https://s3.eu-west-1.amazonaws.com/packages-cloud-prod-data.jetbrains.com/a_very_long_url_containing_my_file_location_blablabla_lib.jar?and=a&lot=of&parameters
[11:39:34] 2024-02-09T11:39:33.998+0000 [DEBUG] [de.undercouch.gradle.tasks.download.internal.DebugInterceptor] Sending request:
[11:39:34] > GET /packages-cloud-prod-data.jetbrains.com/a_very_long_url_containing_my_file_location_blablabla_lib.jar?and=a&lot=of&parameters
[11:39:34] > Authorization: Bearer *******
[11:39:34] > Accept-Encoding: gzip, x-gzip, deflate
[11:39:34] 2024-02-09T11:39:34.007+0000 [DEBUG] [de.undercouch.gradle.tasks.download.internal.DebugInterceptor] Received response:
[11:39:34] < HTTP/1.1 400 Bad Request
[11:39:34] < x-amz-request-id: SZKT6JP65FXKRD33
[11:39:34] < x-amz-id-2: oTW1eHp4rBUsX6tt9chuCsEXAV8RV2rj+r56uBYWk6L35+/jfiZCRQiIgDPuBBRn1CdOVVL7q7I=
[11:39:34] < Content-Type: application/xml
[11:39:34] < Transfer-Encoding: chunked
[11:39:34] < Date: Fri, 09 Feb 2024 11:39:33 GMT
[11:39:34] < Server: AmazonS3
[11:39:34] < Connection: close

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions