1

We are having this issue where since some recent update the AWS SDK for Java always sends a x-amz-content-sha256 hash header in S3 putObject requests.

That works fine with AWS but our allegedly compatible cloud provider actively does not support any form of hash check and simply returns

The provided 'x-amz-content-sha256' header does not match what was computed. (Service: S3, Status Code: 400

when they see the unsupported header.

We cannot live forever in an outdated AWS SDK client version; Is there any way to drop the header? (Looking at the documentation I see request config overrides like https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/core/client/config/ClientOverrideConfiguration.Builder.html but they only allow adding or modifying, not removing?)

1 Answer 1

5

A colleague found the right override: https://sdk.amazonaws.com/java/api/latest/software/amazon/awssdk/services/s3/S3BaseClientBuilder.html#requestChecksumCalculation(software.amazon.awssdk.core.checksums.RequestChecksumCalculation)

So, the fix is simple: Just add .requestChecksumCalculation(RequestChecksumCalculation.WHEN_REQUIRED) to your S3Client.builder() and it will work just as smoothly as before the update to AWS SDK >=2.30.0.

Caveat: This was introduced in 2.30.0 so your code will not be backwards compatible after this change (It boggles my mind why they did not make the backwards-compatible-for-everyone option the default. Amazon being Amazon, I guess).

Sign up to request clarification or add additional context in comments.

1 Comment

Apparently related to minio.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.