I'm saving images to my s3 bucket, generate a presigned URL and save that as a field in my model schema. When my frontend retrieves the model objects from the backend it uses that URL to retrieve the images.
The max expiration date you can set with v4 is 7 days. So what is the best practice to handle the "refreshing" of those URLs?
Things I thought about:
The best practice is do not store pre-signed URLs .
Instead, generate them on-the-fly when they are required. They only take a couple of lines of code to generate, and generation does not involve a call to AWS.
So, whenever the app needs to reference a pre-signed URL, immediately generate and use it. There will be no need to worry about expiration times.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.