I'm trying to force the download of an image, that is hosted in the Content Builder, from a Cloud Page using JS.

Everything work properly if I use an image hosted on https://imgur.com/ but if I use an image hosted in the Content Builder i receive the following exception "Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource..."

Do you have some idea on how to solve this?

  • 1
    It may be worth asking Support whether it's possible for SFMC to have OPTIONS requests enabled and CORS headers added to responses by Akamai. It's possible, with an OEM Akamai account, but I don't think it's possible for SFMC to enable this for you. It's worth asking. Can you alter the code that loads your images such that AJAX isn't making the request, but rather manipulate the DOM to add image tags? Would you consider using a proxy running on something like Heroku to act as an intermediary, accepting OPTIONS requests and adding CORS headers on the way through? – Macca Jul 8 '19 at 23:48
  • I could try to ask to the Support to enable CORS headers options, but i don't have enough time to wait the back and forth with them... i need to achive the result right now ;) Since we have an Akamai account for other contents i'll do that outside SFMC. – Andrea Messini Jul 11 '19 at 17:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.