For small files, say <5Mb, uploading to S3 using the assigned URL works fine. When I try to download anything more than this, I seem to get answers 400 Bad Request
from S3 with RequestTimeout
as an error.
I can recreate this with curl:
mkfile -n 20m ./testfile
curl -XPOST http://localhost:3000/uploads -d "filename=testdata"
curl -H "Content-Type: binary/octet-stream" -XPUT -vvv -T testfile "<Presigned URL>"
The signature code is as follows:
@presigned_url ||= Aws::S3::Presigner.new.presigned_url(
:put_object,
bucket: ENV['AWS_BUCKET'],
key: key,
acl: 'private',
expires_in: 3600,
content_type: 'binary/octet-stream'
)
Please note that all this works fine for files <5Mb, with more frequent crashes that occur when the file size increases. Has anyone seen these problems and resolved them?
source
share