假设我有以下存储桶名称long.bucket.name
。使用CLI aws s3 presign
时,我得到的URL格式为:
https://s3.amazonaws.com/long.bucket.name/path/to/key?AWSAccessKeyId=123&...
但是,在使用GeneratePresignedUrlRequest
Java库时,我得到的URL的格式为
https://long.bucket.name.s3.amazonaws.com/path/to/key?AWSAccessKeyId=123&...
此网址存在问题,因为通配符导致SSL认证失败(请参阅http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html)。如果我尝试使用相同格式的URL https://s3.amazonaws.com/long.bucket.namae...
,签名验证将失败
The request signature we calculated does not match the signature you provided. Check your key and signing method
我唯一能做的就是使用不理想的http
。如何正确生成Presign URL?