Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Referencing assets from a CDN using the acs.commons.rewriter component

Avatar

Level 1

We want to use a CDN with our AEM project to serve up the assets (images, scripts, css), so I've configured the aem-commons rewriter component to reference the assets from a static domain.  I can see the rewriter in action, and the images are now being pulled from the static domain, but the images appear to be broken links. Now that I'm looking at this more closely, I can see in my browser inspector that AEM has renamed the images different from the source file, and they have been changed to a number string.  eg. What I would have expected to see is:

"<img src="/content/test/_jcr_content/par/image.img.png/banner-1.png>" 
but now I see

"<img src="/content/test/_jcr_content/par/image.img.png/1462897411261.png>".  

Obviously, if I upload my images to the CDN with their original names then the images will look broken on the site because the names are all wrong.

What is the best approach here?  Is there a way to download the DAM which will give me all of the assets with their AEM names, which I can then upload to the CDN?  Or is there a way to configure AEM to not rename the assets so they keep their original names (which incidentally are also their filenames in the DAM)?

Or is there another way to do this altogether that I haven't considered?

Thanks,
Matt

1 Accepted Solution

Avatar

Correct answer by
Level 1

Thanks for the reply Mark.  Sorry for the tardy reply, but I thought I'd put some notes down here in case someone else runs into the same thing.

It turns out that the AEM image component was the culprit.  When using a resourceSuperType of 'wcm/foundation/components/image', AEM creates a bunch of renditions of your images - this is where the file naming went awry.  If I don't use the image resourceSuperType on my component then the renditions don't get created and my file name remains the same as the original file name.

For anyone else looking to use a static domain to host your images/assets, the ACS Static Reference Rewriter works great.

View solution in original post

2 Replies

Avatar

Employee

Hi Matt,

You may want to check over on to see if there is some issue https://gitter.im/Adobe-Consulting-Services/acs-aem-commons

I am not familiar with the component you use but if you have content on Author and it is pushed to Publish nodes and works fine, then it doesn't matter what it is called (except for SEO / search)

But in general terms;

You don't upload content to a CDN - you set an origin hostname for your site and have your CDN configure that to pull from. Your site URL will be CNamed to the CDN provider's service. Your CDN partner will be able to advise here.

Found this article:

http://cq-ops.tumblr.com/post/110829806684/how-to-integrate-aem-with-a-cdn-such-as-akamai

Mark

Avatar

Correct answer by
Level 1

Thanks for the reply Mark.  Sorry for the tardy reply, but I thought I'd put some notes down here in case someone else runs into the same thing.

It turns out that the AEM image component was the culprit.  When using a resourceSuperType of 'wcm/foundation/components/image', AEM creates a bunch of renditions of your images - this is where the file naming went awry.  If I don't use the image resourceSuperType on my component then the renditions don't get created and my file name remains the same as the original file name.

For anyone else looking to use a static domain to host your images/assets, the ACS Static Reference Rewriter works great.