cancel
Showing results for 
Search instead for 
Did you mean: 

Question on how to customize media url generation

Former Member
4,317

Hi there,

I am trying to use a CDN for media items. The goal is to customize the generation of the URL field of Media items. I know that I have to use MediaURLStrategy to achieve this but unfortunately it does not work.

Here is what I did:

  • Implemented MediaURLStrategy interface in my custom url strategy

  • Configured a media folder in local.properties to use this custom url strategy

  • The custom url strategy does get called when I open a media item in the backoffice

  • Unfortunately only the downloadURL is being set via the strategy. The URL of the media item stays empty.

Now my question: How do I make sure that media items in the given folder get assigned the correct URL from the custom strategy?

I did not create a custom MediaStorageStrategy as I did not see why I would need one.

Thanks in advance!

View Entire Topic
Former Member

Ultimately I've found out that HMC and Backoffice seem to use the internalUrl field of the media items directly. The storefront however correctly makes use of the strategy with the given configuration. For the backoffice/hmc issue my workaround consisted of setting the internalUrl field of the media items to the actual url which makes the images visible there.