Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

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

Avatar

Avatar
Validate 1
Level 1
mattk4043901
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
mattk4043901
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
View profile
mattk4043901
Level 1

10-05-2016

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

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 1
mattk4043901
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
mattk4043901
Level 1

Likes

0 likes

Total Posts

4 posts

Correct Reply

1 solution
Top badges earned
Validate 1
View profile
mattk4043901
Level 1

31-05-2016

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.

Answers (1)

Answers (1)

Avatar

Avatar
Boost 5
Employee
mvance
Employee

Likes

5 likes

Total Posts

73 posts

Correct Reply

42 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile

Avatar
Boost 5
Employee
mvance
Employee

Likes

5 likes

Total Posts

73 posts

Correct Reply

42 solutions
Top badges earned
Boost 5
Boost 3
Boost 1
Applaud 5
Affirm 5
View profile
mvance
Employee

12-05-2016

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