Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using S3 presigned url from CloudFront #6

Open
aldy120 opened this issue Aug 11, 2019 · 1 comment
Open

Using S3 presigned url from CloudFront #6

aldy120 opened this issue Aug 11, 2019 · 1 comment

Comments

@aldy120
Copy link
Owner

aldy120 commented Aug 11, 2019

I try to access CloudFront by using S3 presigned url format. e.g., http://d3cpkzzxx5hfjb.cloudfront.net/jdhfalkwejfhalwekjfhaw/Sabrva.zip?AWSAccessKeyId=AKIAJMQJIRI6AYFKCXTA&Expires=1565932789&Signature=IhROayuoZOEq6iMWaYg%2BJ1oPfPM%3D.

Error messages

<Error>
<Code>InvalidArgument</Code>
<Message>
Only one auth mechanism allowed; only the X-Amz-Algorithm query parameter, Signature query string parameter or the Authorization header should be specified
</Message>
<ArgumentName>Authorization</ArgumentName>
<ArgumentValue>
AWS4-HMAC-SHA256 Credential=AKIAJ6GERVB2PHI4WAZQ/20190811/ap-northeast-1/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date, Signature=e02bea4bdc6fb29f7a3b8d44d2eae9c2811ef0bc1607b6c1f6d9e7a390d84694
</ArgumentValue>
<RequestId>8F944F84FC8110D6</RequestId>
<HostId>
qjtLKCLpc/aMl9GfjsAVB30/TeiRW4FsezyJ2KrEhJ24WUZbJR+TqhdZuhbMRMSHnTF2dCD+IpA=
</HostId>
</Error>

or

<Error>
<Code>AccessDenied</Code>
<Message>Access Denied</Message>
<RequestId>1E75A91CCD22E0C9</RequestId>
<HostId>
QJLR5QgX9BlQhLH8k0sZzmOY6ZdRdRQDfdsaS/sU5vHjfWU1lfwtc/XEsfl5VDeWFvWs1yJh8tY=
</HostId>
</Error>

To solve it

  • Forward all query string. (CloudFront does not forward query strings by default).
  • Disable origin access identity (S3 only allow one auth mechanism at the same time).
@aldy120
Copy link
Owner Author

aldy120 commented Jul 14, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant