Last active
December 21, 2023 20:38
-
-
Save hirobert/1200126f01362e24d9b9 to your computer and use it in GitHub Desktop.
response-content-disposition and cloudfront
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This was helpful, thanks!