AWS Upload file to S3 REST API - Missing required header for this request: x-amz-content-sha256

17.3k Views Asked by At

Unfortunately i cannot use AWS SDK and i must use REST API AWS services(i am working with Flutter WEB). So i start to do research on aws docs and this is what i did:

  1. Create bucket.

  2. make all permission to be public(for test only)

  3. open access point

Then at the postman i am using at "Auth" aws signature and added current keys, except session token(my bucket is open and i understood that i dont need it, if i am mistaking pls correct me). when i am sending the request i am getting an error:

Missing required header for this request: x-amz-content-sha256

Here is attachment images:

AWS Signautre Aws signuture

Body Request Body request

Error messageenter image description here

4

There are 4 best solutions below

0
On

According to the AWS documentation, you need to send the x-amz-content-sha256 header in the request:

The x-amz-content-sha256 header is required for all AWS Signature Version 4 requests. It provides a hash of the request payload. If there is no payload, you must provide the hash of an empty string.

Seems like Postman is not adding it for some reason. You should check the Headers and add manually then.

1
On

try replacing S3 with s3 for the service name.

0
On

Just ran into this issue too - the Service Name must be 's3' vs 'S3'.

advanced authorization settings

0
On

I too faced this issue and after adding session token parameter it got resolved. Postman has the provision to generate the below parameters,

  1. X-Amz-Content-Sha256
  2. Authorization
  3. x-amz-security-token
  4. X-Amz-Date