Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
response-content-disposition and cloudfront
1) Log in to aws console.
2) Click cloudfront
3) Click behaviors
4) Select pattern and edit
5) Set Forward Query Strings - Yes
6) click "Yes, edit" to save your edits
7) It may take some time for cloudfront cache to expire, so that these changes take effect
8) Your code should do something like below.
Add the escaped string as a query string to the url before signing it.
from boto.cloudfront.distribution import Distribution
d = Distribution()
encoded_headers = 'response-content-disposition=attachment%3B%20filename%3Dname_of_file_here.txt'
url = d.create_signed_url('%s%s?%s' % (hostname, filepath, encoded_headers),
key_id,
private_key_string=private_key_string,
expire_time=ttl)
@samuel-cloete

This comment has been minimized.

Copy link

@samuel-cloete samuel-cloete commented Nov 29, 2017

This was helpful, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment