Question

I'm using Mezzanine, django-compressor and amazon-s3. I use django-compressor to compress css file. I have deployed the website to Heroku and stored the static resource successfully. However, after a period, all the css are lost. And below is the notification from amazon-s3:

<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<RequestId>FCE5D863FC2EBB9D</RequestId>
<Expires>2012-11-16T17:30:01Z</Expires>
<HostId>
aXa9JBZWx5UiwJmIfpTXsUZgeNGQDONx0G/IezufvWv1FwAUlnK8bzo2u+Qdsenj
</HostId>
<ServerTime>2012-11-16T18:10:17Z</ServerTime>
</Error>

And this is the config in setting:

from datetime import date, timedelta
ten_years = date.today() + timedelta(days=365*10)
# Expires 10 years in the future at 23h GMT
AWS_HEADERS = {
    'Expires': ten_years.strftime('%a, %d %b %Y 23:00:00 GMT'),
    'Cache-Control': 'max-age=386900',
}

Please help me to resolve this problem. I can not find out the root cause. Thank you so much.

Was it helpful?

Solution

It is because of accessing signed url.You can do below setting in settings.py to avoid this

AWS_QUERYSTRING_AUTH = False
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top