2016-01-20 136 views
0

我無法訪問該文件,我嘗試通過預先簽名的URL訪問該文件。無法從對象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(); 

當網址在瀏覽器來訪問我得到:

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'); 

我仍然收到相同的錯誤。

這裏是鬥許可快照:

enter image description here

+0

看起來你的客戶端不支持必要的加密算法。 –

+0

@GeraldSchneider對不起,這是什麼意思? –

+0

我沒有使用AWS的經驗,所以這只是一個猜測。但服務器正在抱怨你的客戶端不支持'AWS4-HMAC-SHA256',這是加密算法中常見部分的一種亞馬遜變體。您的客戶端不支持它(可能已過時),或者它配置錯誤。 –

回答