aws / aws-sdk-go-v2

AWS SDK for the Go programming language.
https://aws.github.io/aws-sdk-go-v2/docs/
Apache License 2.0
2.57k stars 620 forks source link

s3manager: Signature errors when proxies don't respect `Range` headers #2722

Closed gdavison closed 1 month ago

gdavison commented 1 month ago

Acknowledgements

Describe the bug

When used from behind a caching proxy, if the proxy is not configured to pass requests with a Range header unchanged, the AWS API returns signature errors. This appears to be because the Range header is included in the signed headers.

Expected Behavior

The expected behaviour is that the requests would succeed, either with parallel requests or with a fallback to requesting the full object.

Current Behavior

The requests fails with a SignatureDoesNotMatch error.

The request contains the header values:

In the error response, the <CanonicalRequest>, however shows an empty range:, suggesting that the user's proxy remove the Range header.

Reproduction Steps

Use the S3 Download manager from behind a proxy, e.g. nginx, which strips the Range header from a request.

Possible Solution

Possible solutions are:

Additional Information/Context

These are the errors reported to us:

AWS Go SDK V2 Module Versions Used

github.com/aws/aws-sdk-go-v2 v1.30.3 github.com/aws/aws-sdk-go-v2/feature/s3/manager v1.17.8 github.com/aws/aws-sdk-go-v2/service/s3 v1.58.2

Compiler and Version used

go version go1.22.5 darwin/arm64

Operating System and version

macOS 13.6.7 (22G720)

lucix-aws commented 1 month ago

We call this out in the FAQ - proxies are known to cause issues with signature mismatch as they either add or remove headers.

This isn't behavior we can change by default. The user's only present recourse here is to control the proxy behavior to not modify the request.

github-actions[bot] commented 1 month ago

This issue is now closed. Comments on closed issues are hard for our team to see. If you need more assistance, please open a new issue that references this one.