Closed jbarnobal closed 6 years ago
my image link got this
{
"error": {
"message": "Stale request - expires_at 2018-07-27 03:23:52 +0000 has passed"
}
}
Seem the problem is like this https://leavingharbor.com/posts/gotcha-with-active-storage-and-cloudflare
@jbarnobal, have you tried using the provided helpers, #url_for
and/or #rails_blob_url
? Either will provide you a permanent URL that points to your application and redirects your to the actual (short-lived) service url only when you want to access it.
Ideally, you shouldn't be accessing the #service_url
directly but rather use either of the provided helpers. So in your case, you will want to do
...
url: url_for(@image.image)
...
or
...
url: rails_blob_url(@image.image)
...
The 5 mins expiration is an expected behaviour. Please see: https://edgeguides.rubyonrails.org/active_storage_overview.html#linking-to-files
My Activestorage routes outside
post 'upload', to: 'projects#upload'
my upload method
Upload is working fine but after 5minutes or more i got a CORBS warning GET https://api.cloudinary.com/v1_1/saintlucifer91/image/download?api_key=576932957151598&attachment=false&expires_at=1532661832&public_id=ndN5keoAccUwGzF7AUqyqSZ7&signature=033b7b7c4c95dcdbb54a77ef37caf32b96d0a657×tamp=1532661532&type=upload 401 (Unauthorized)