Requires a valid Date header or x-amz-date?

When I try to upload a file to S3, I get the following error:

S3StorageError: <?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>AWS authentication requires a valid Date or x-amz-date header</Message><RequestId>7910FF83F3FE17E2</RequestId><HostId>EjycXTgSwUkx19YNkpAoY2UDDur/0d5SMvGJUicpN6qCZFa2OuqcpibIR3NJ2WKB</HostId></Error>

I am using Django with Django-Storages and Imagekit

My S3 settings in my settings.py look like this:

locale.setlocale(locale.LC_TIME, 'en_US')
DEFAULT_FILE_STORAGE = 'backends.s3.S3Storage'
AWS_ACCESS_KEY_ID = '************************'
AWS_SECRET_ACCESS_KEY = '*****************************'
AWS_STORAGE_BUCKET_NAME = 'static.blabla.com'
AWS_HEADERS = {
       'x-amz-date': datetime.datetime.utcnow().strftime('%a, %d %b %Y %H:%M:%S GMT'),
       'Expires': 'Thu, 15 Apr 2200 20:00:00 GMT',
}
from S3 import CallingFormat
AWS_CALLING_FORMAT = CallingFormat.SUBDOMAIN

Thanks for any help you can give!

+3
source share
2 answers

, , , . , . , ( s3, , s3fox, s3hub ..).

+1

, "x-amz-date" settings.py, .

, , - .py .

, django-storages , .

, django-, . BitBucket : http://code.welldev.org/django-storages/issue/56/aws-authentication-requires-a-valid-date-or-x-amz-date

0

Source: https://habr.com/ru/post/1739939/


All Articles