我正在尝试由邮递员向S3发出发布请求,但我收到了response code 403 - Forbidden
。 CORS和政策是权利,我使用预先签名的网址:
url = _client.generate_presigned_post(Bucket=_BUCKET_NAME, Key=key,
Fields={'acl': 'public-read', 'Content-Type': 'image/jpeg'},
Conditions=[
{'acl': 'public-read'},
{'success_action_status': "201"},
['starts-with', '$key', ''],
['content-length-range', 0, 100000],
{'x-amz-algorithm': 'AWS4-HMAC-SHA256'},
{'Content-Type': 'image/jpg'}
],
ExpiresIn=expiration)
邮递员的回复:
<?xml version="1.0" encoding="UTF-8"?>
<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<Expires>1970-01-05T04:00:00Z</Expires>
<ServerTime>2019-06-11T12:40:50Z</ServerTime>
<RequestId>xxxxxxxxxxx</RequestId>
<HostId>xxxxxxxxxxxxx</HostId>
</Error>
答案 0 :(得分:0)
我的问题出在水桶的政策上。我修复了将Resource
更改为"arn:aws:s3:::mi-stagging"
的{{1}}