How to avoid broken URLs when operating multiple unsynchronized platforms?

Sometimes in large-scale systems, and for different design reasons, one may end up operating two unsynchronized platforms, when one is in charge of uploading/fetching new content to store on Cloudinary, and the other of processing or making requests to these supposedly uploaded images.

In the rare case of images being requested from the frontend before actually being uploaded to your account, some 404 (Resource Not Found) errors may be raised. Cloudinary caches this errors for an exponentially growing amount of time. This may cause some URLs on your application to remain broken even though the image was successfully uploaded and stored on your account.

The best practice for avoiding such incidents, is to utilize our default image feature when requesting images which liable to be missing. Doing so will prevent 404 errors and will generate a placeholder for every non-existing image that was requested. For example:

In the upload API call, setting both overwrite and invalidate parameters to true will ensure that all URLs are refreshed on the CDN once the actual image becomes available. For example (in Rails):

  Cloudinary::Uploader.upload('my_image.jpg', :public_id => 'some_image', :overwrite => true, :invalidate => true)
Have more questions? Submit a request


Powered by Zendesk