David Kimura PRO said about 6 years ago on SimpleMDE and ActiveStorage :
I believe that this is caused by the `url_for` which creates the `presigned_key` URL and has a 5 minute default expiration. You could instead of the JSON response of the direct URL, you send the response back which goes to the SHOW action of the ArticleImage. The show action will get the record and redirect to the S3 link from the `url_for`. This could have the added benefit of checking authorization/authentication of the image about to be displayed to a user. This would also solve the expiration time as it would generate a new link. You could also wrap the `url_for` with a `Rails.cache.fetch` and set the expiration to 5 minutes to prevent the overhead of having to get another signed url for every request of the same image within the given interval.