I use DigitalOcean Spaces as a storage for /media/
files in Django using django-storages
. I need files to send X-Frame-Options:'ALLOWALL'
when they are fetched from Spaces so they can be displayed in iframe
.
How can I do that? U use boto3
Doesn't work:
AWS_HEADERS = {
"X-Frame-Options": "ALLOWALL",
}
Returns error when uploading file:
AWS_S3_OBJECT_PARAMETERS = {
'X-Frame-Options': 'ALLOWALL'
}
Error:
Invalid extra_args key 'X-Frame-Options', must be one of: ACL, CacheControl, ChecksumAlgorithm, ContentDisposition, ContentEncoding, ContentLanguage, ContentType, ExpectedBucketOwner, Expires, GrantFullControl, GrantRead, GrantReadACP, GrantWriteACP, Metadata, ObjectLockLegalHoldStatus, ObjectLockMode, ObjectLockRetainUntilDate, RequestPayer, ServerSideEncryption, StorageClass, SSECustomerAlgorithm, SSECustomerKey, SSECustomerKeyMD5, SSEKMSKeyId, SSEKMSEncryptionContext, Tagging, WebsiteRedirectLocation