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

Public and private objects on S3 via Cloudfront? #456

Closed
mrmachine opened this issue Jan 24, 2018 · 7 comments · Fixed by #587
Closed

Public and private objects on S3 via Cloudfront? #456

mrmachine opened this issue Jan 24, 2018 · 7 comments · Fixed by #587
Labels

Comments

@mrmachine
Copy link

The django-storages docs just say I should set the AWS_S3_CUSTOM_DOMAIN setting and configure Cloudfront. The Cloudfront docs say I can restrict access and require signed URLs.

I already use signed S3 URLs with django-storages, and these URLs have Expires, Signature and AWSAccessKeyId querystring params. The Cloudfront docs say signed cloudfront URLs need Expires, Signature and Key-Pair-Id querystring params.

How can I get django-storages to generate a signed Cloudfront URL? Is it even possible?

@mattjegan
Copy link

I just came across this issue, my current solution is to override S3Boto3Storage.url so it doesn't return early for custom domains. It will sign the s3 url and then we can replace the domain manually. I'm not sure if there is anything nicer. If I get time I might make a PR back in.

@terencehonles
Copy link
Contributor

@mrmachine if you use the branch that is #587 you can specify one or more RSA keys and the signing function will use the first key or the key by the ID you specify.

@DataGreed
Copy link

Is there an existing solution for this problem?

@DataGreed
Copy link

@jschneier @terencehonles it's great the django-storages supports Cloudfront URL Signing, but there seems to be no documentation at all. How do I make it work?

@terencehonles
Copy link
Contributor

@DataGreed it looks like you figured it out and posted an example on #587, I commented there, but any chance you want to expand the documentation? 🙂

@shawnngtq
Copy link

@DataGreed

It will be great if you can include an example regarding cloudfront settings. I am new to cloudfront and this library 😁

@terencehonles
Copy link
Contributor

@shawnngtq you can use @DataGreed and my comments starting here #587 (comment) to probably get yourself set up 🙂

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