You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The application we are working with uploads objects to buckets with Object Lock enabled, where a retention period is set, using usePresignedUpload().
However, as per the AWS documentation, it is currently impossible to upload objects within buckets with Object Lock enabled and a retention period set, unless the Content-MD5 header is included in the request. As explained from the AWS docs
The Content-MD5 header is required for any request to upload an object with a retention period configured using Amazon S3 Object Lock
Currently, s3-upload is only able to pass custom headers to /api/s3-upload, and the only headers that we are passing to the PutObject request are Content-Type and Cache-Control.
That's a very handy feature that I would love very much to see added to this library.
But... since the MD5 Digest is required by AWS for immutable buckets, maybe the library could calculate the digest for the application? 💭
I'm not sure if the philosophy of this library is "battery included", but if it is, then I believe it would be a perfect fit.
The exposed API could be something simple like a property:
The application we are working with uploads objects to buckets with Object Lock enabled, where a retention period is set, using
usePresignedUpload()
.However, as per the AWS documentation, it is currently impossible to upload objects within buckets with Object Lock enabled and a retention period set, unless the Content-MD5 header is included in the request. As explained from the AWS docs
Currently,
s3-upload
is only able to pass custom headers to/api/s3-upload
, and the only headers that we are passing to the PutObject request areContent-Type
andCache-Control
.To address this issue, we want to pass the MD5 digest to the request inside https://github.com/ryanto/next-s3-upload/blob/master/packages/next-s3-upload/src/hooks/use-presigned-upload.ts#L15-L16. The header should be optional and the digest value should be calculated from the application code.
I’d be happy to open a pull request to enable the passing of the
Content-MD5
header (or any other extra headers) to the pre-signed upload request.The text was updated successfully, but these errors were encountered: