我无法访问该文件,我试图通过预先签名的URL访问该文件。
$cmd = $s3Client->getCommand('GetObject', [
'Bucket' => 'test-bucket-pcloud',
'Key' => 'testfile.txt'
]);
$request = $s3Client->createPresignedRequest($cmd, '+20 minutes');
// Get the actual presigned-url
$presignedUrl = (string) $request->getUri();
在浏览器上访问URL时,我得到:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AuthorizationQueryParametersError</Code>
<Message>X-Amz-Algorithm only supports "AWS4-HMAC-SHA256"</Message>
<RequestId>8D109D39C69E665D</RequestId>
<HostId>
lH+u+MEnbF+Sps0kd/tMEGS0ePHjQlUDGWN8lLnzkXYkrIb0YksK6ahzUflPFMbQG8zUzLFl9y4=
</HostId>
</Error>
它可能是什么原因?此外,当我尝试从获取的URL访问存储桶时:
$signedURL = $s3Client->getObjectUrl('test-bucket-pcloud','testfile.txt');
我仍然得到同样的错误。
以下是存储桶的权限快照:
答案 0 :(得分:0)
您是否检查过CORS配置?
https://aws.amazon.com/blogs/aws/amazon-s3-cross-origin-resource-sharing/
在常见的CORS配置中,您可以允许原点,方法和标题。我将首先添加一个CORS配置。