- 最新
- 投票最多
- 评论最多
Still having this issue, though when I try my request from a different box (the first was on a mac) I get a different failure:
aws s3api put-object --endpoint-url https://mydomain.com --bucket mybucket --key myfile.txt
An error occurred (SignatureDoesNotMatch) when calling the PutObject operation: The request signature we calculated does not match the signature you provided. Check your key and signing method.
The same request works from both boxes when I use the standard s3 endpoint, so I still think this must be an issue with my cloudfront configuration.
aws s3api put-object --endpoint-url https://s3.amazonaws.com --bucket mybucket --key myfile.txt
The issue was: The client signs the request using the custom domain; but then when S3 gets the request from CloudFront it expects the request to be signed for s3.amazonaws.com, not the custom domain.
Resolution: Depending on the client you use, you might be able to set the custom endpoint after the request (and signature) is created. See https://github.com/aws/aws-sdk-go/issues/826#issuecomment-247651352 for an example.
Unfortunately, this is not possible with the Java SDK. Our solution will be to either write a wrapper around S3's Java Rest SDK, or:
Skip CloudFront altogether and use an nginx proxy instead with a configuration that includes something like:
proxy_set_header Host mybucket.s3.amazonaws.com
相关内容
- AWS 官方已更新 9 个月前
- AWS 官方已更新 2 年前