Closed jfacorro closed 4 years ago
Using the S3 client (Erlang or Elixir) in the following way results in a 403:
1> aws_s3:put_object(aws_client:make_client(), <<"bucket-name">>, <<"object/key">>, #{<<"ACL">> => <<"private">>, <<"ServerSideEncryption">> => <<"AES256">>, <<"ContentType">> => <<"text/plain">>}). {error,#{<<"Error">> => #{ %% ... <<"Message">> => <<"The request signature we calculated does not match the signature you provided. Check your key and si"...>>, %% ... }, ... }
This is because the request includes a duplicated content-type header as a result of providing the ContentType header parameter:
ContentType
PUT /bucket-name/object/key content-type:text/plain content-type:text/xml host:s3.eu-west-1.amazonaws.com x-amz-acl:private x-amz-content-sha256:e3b0c x-amz-date:20200814T125145Z x-amz-security-token:Fwo... x-amz-server-side-encryption:AES256
We need to make sure the header is added only if it does not already exist in the provided headers.
Using the S3 client (Erlang or Elixir) in the following way results in a 403:
This is because the request includes a duplicated content-type header as a result of providing the
ContentType
header parameter:We need to make sure the header is added only if it does not already exist in the provided headers.