When you overwrite an existing asset with a new file that uses the same public_id
value, your Cloudinary account will be updated with the new image and new requests we receive for that resource will be served the new image right away.
If the asset was already in use in your application or website, when accessing existing URLs for that asset, you may still see a CDN cached version of the previous file instead of the new, updated image. It's also possible that your browser or another third-party cache has stored the old file and is still showing it to you.
CDN invalidation
Firstly, when overwriting the asset, if you set the invalidate
parameter to true
in your API call, we will send requests to our CDNs to clear any cache for the overwritten asset. This parameter is sent automatically if you replace an asset using our Media Library UI. Note that it typically takes a few seconds for the invalidation to be processed take effect, but invalidation can take up to an hour to fully propagate through our CDNs.
By default, all possible delivery URLs for an asset will be invalidated, but if you have an older account using non-standard options, you may need to ask us to change the invalidation behavior for your account.
For more information about CDN invalidations, please see the upload API documentation
https://cloudinary.com/documentation/additional_upload_api_options#invalidating_cached_media_assets_on_the_cdn
Bypassing browser and other caches
Alternatively, or if you need to bypass users' browser caches as well as our CDN caches, you can include the optional version component as part of your asset delivery URLs.
The version number of an asset is included in theversion
property when you receive the asset's details using our Upload API and Admin API responses. The url
or secure_url
parameters of our APIs also include an asset's current version, as do the URLs retrieved through our media library UI.
If you keep your database up to date with the version number for each asset and use it in the URLs that your application creates, you'll always receive the newest version of the asset, even if the user or a third party has cached it: https://cloudinary.com/documentation/upload_images#asset_versions
Comments
33 comments
Thanks
Shirly said: You can add `invalidate:true` on upload and it will invalidate the new version. For example in NodeJS:
Why does this not work for Unsigned Uploads? This thing is driving me nuts! It's seriously changing my mind about using Cloudinary in my projects.
Hi Malcolm,
When using unsigned upload we don't allow updating/deleting existing images. It for security reasons. because unsigned upload can upload is for anyone to upload assets to your account but we don't want to let them delete or update your existing assets.
Hope it makes sense,
Shirly
Please sign in to leave a comment.