Resource URL not working

Comments

5 comments

  • Official comment
    Avatar
    Akshay Ranganath

    Hi Daniel,

    Fetch URLs are disabled by default on all accounts. This is just to prevent malicious users loading unnecessary images.

    To enable fetch, please do the following. 

    • Login to your Cloudinary portal.
    • Click on Settings (gear icon towards top right)
    • Navigate to the Security tab
    • In the section Restricted Media Type, there will be an option named Fetched URL. Uncheck and save.

    This will enable Fetch on your account. Here's the setting.

    Additionally, we recommend that you consider locking down the fetch targets to a fixed set of domains or a fixed set of referrers.

    • Domain restriction will ensure that Cloudinary will only fetch from the set of domains that you whitelist.
    • Referrer restriction will ensure that fetch only if the request is being made from a whitelisted source website. 

    Both the options are on the same Security section of the Cloudinary settings page.

    Let me know if this works.

    Thanks,

    Akshay

    Comment actions Permalink
  • Avatar
    Daniel K.

    Hello Akshay,

    as mentioned in my original post, I had already unsuccessfully tried to fetch with these restrictions turned off.

    I have investigated a bit further, and the problem seems to be related to the Cloudinary cache. After adjusting the settings, I was only able to get images from the CDN after manipulating the URLs to request image sizes which has never been requested before.

    It seems that the cache isn't cleared after a settings change, and that is really confusing and should be changed or at least mentioned on the settings page.

    0
    Comment actions Permalink
  • Avatar
    Akshay Ranganath

    If I understand your comment, you are indicating that when you first fetched the image it was perhaps not available and we sent down a 404. Subsequently, this 404 remained even after the image was available on the remote sever. Was this the behavior that you noticed?

     

    0
    Comment actions Permalink
  • Avatar
    Daniel K.

    Hello Akshay, that is correct.

    0
    Comment actions Permalink
  • Avatar
    Akshay Ranganath

    Thank you, Daniel.

    So in this case, it was the not fetch that was an issue but, the removal of 404 cached object. The 404 error is cached based on an exponential backoff algorithm. To ensure you don't run into the problem, the best approach would be to issue a cache invalidation once the original image is available on your remote sever. After uploading the correct image, you can issue a cache invalidation using the explicit method. In this method, ensure that the flag invalidate=true is set. By doing so, the CDN cache will be cleared and you should not see the error.

    Let me know if this helps.

    0
    Comment actions Permalink

Please sign in to leave a comment.