Skip to main content

Universal version component in URL to fetch the last version of file from CDN



  • Freddy May

    Our files are in the folders. It may be necessary to use v1 version component. I didn't use v1 when I tried to invalidate the CDN cache on uploading. 

  • Aleksandar Kostadinov

    Hi Freddy,

    Please note that there are three possible URL formats we can send for invalidation at the CDN, and these are outlined here:

    Invalidation requests are sent when you delete or overwrite an image using our Media Library UI, or when you use the SDK/API, and also provide the 'invalidate' parameter, set to 'true'.

    By default, all accounts send invalidations for the default format of URL which our SDK produces, which uses no version number for assets in the root of your account, and a 'v1' placeholder for assets in folders (option 1 from the URL above).

    Your account is currently configured using the default settings (option 1 from the list above) which means for assets in the root of the account it will invalidate the URL without a version number, while URLs in folders like in this case, would invalidate the URL with a 'v1'.

    You can continue to use the current URL format (option 1)  and if you're already using our helper SDK methods for generating the URLs then this may be the best approach as it won't require any updates on your side. The CDN will already invalidate this URL format as it's what the default configuration on the account is set to.

    On the other hand, if you're creating the URLs manually and not using the helper methods, then what might be easier for you is if you use no version component (option 2) for both assets in folders and in the root of your account. If this is something you'd like then please let me know and I can go ahead and configure your account to invalidate this specific URL format.

    When combined with the invalidate flag on re-uploads the same URL will be serving the newest image if you're requesting the image with the URL format that the account is configured to invalidate. The CDN invalidation is quick and will be done within seconds in the vast majority of cases so there shouldn't be any concerns regarding the time taken.

    Please let me know your thoughts.

    Best regards,


  • Freddy May

    Hi Aleksandar,

    Thanks for your response. I think we'll try to use the default settings. I thought that cache invalidation is long operation because I used URLs without version component for assets in folders. I checked the work of  cache invalidation with URLs that contain 'v1' placeholder - it works. Thanks for your help.

  • Aleksandar Kostadinov

    You're welcome, Freddy.

    Yes, when your assets are within folders based on the current account configuration for invalidation you should use 'v1' as the version component and you'll be able to use the same URL when overwriting an asset. Similarly, if you have any assets in the root of your account then you should use no version component in the URLs as this URL format will be invalidated for assets in the root folder.



Post is closed for comments.