Reputation: 1592
I use S3 for media file storage on my Django project.
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
From my iOS project I receive image URLs from Django like
https://my-bucket.s3.amazonaws.com/image-name.jpg?AWSAccessKeyId=<AccesKey>&Signature=<Signiture>
It seems the image URLs are expired after a while(and they probably should). However this causes a problem. When iOS app user left the app and came back after a while and the app memory was alive, the app tries to load images from expired urls(ex. cell reuse) resulting request error.
I wonder what is a right solution for this.
Upvotes: 4
Views: 1976
Reputation: 238597
Your link is so-called S3 presigned URL and their expiration can't be disabled. But you can make it longer. The maximum expiration time is 7 days provided the URL is created using IAM user. If you use IAM role or instance role to make the URLs the max times are 36 and 6 hours respectively.
If these times are not satisfactory, you have three general options:
Upvotes: 4