Expand my Community achievements bar.

SOLVED

Core component image src changes on publish (archetype 35)

Avatar

Level 4

Dear community,

 

We're using 6.5.9 with aem project archetype 35.

As I published pages with image component, the page layout and assets in the component did replicate to DAM on publish instance,

but the src of image cut the "content/{project_name}" in URL, so the image cannot find the src.

 

I tried other demo site on instance (weretail, wknd), there is no problem on publishing image component.

I also checked this thread on community: Images are not loading in publish instance

and modified/deleted org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json on 4503 instance.

But it did't work and crashed the url of the page on publish.

 

I know on publish or dispatcher, the website hides the folder of assets with rewrite rules,

but the default setting should not crash the src.

 

Can anyone help me with this issue?

Thanks!

 

img on author:

YuSheng_0-1677121353122.png

img on publish:

YuSheng_1-1677121605795.png

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

because of this rule, the path is getting trimmed on publish. if you don't have the rewrite rule then you need to remove this config.



Arun Patidar

View solution in original post

7 Replies

Avatar

Community Advisor

Hi @YuSheng ,

 

You must be having a custom link rewriter in your publish instance. Please check /apps/<project>/config/rewriter folder if it does exist.

 

Please check the below video for your reference-

https://www.youtube.com/watch?v=0fM2vUEj2bA&list=PLzwWOJSdKWBf7zLga8P7-ARxFQRwGGd94&index=30&t=237s

 

You can also consider using internal redirect map if you really want the truncated URLs (without /content/<websitename>) in asset paths and still want them to load.

 

https://medium.com/magmalabs-blog/how-to-use-internal-redirects-in-aem-ed465a61a24b

 

Thanks,

Ritesh Mittal

Avatar

Community Advisor

Can you check if you have a osgin config at

/apps/__appId__/osgiconfig/config.publish/org.apache.sling.jcr.resource.internal.JcrResourceResolverFactoryImpl.cfg.json


The mapping is defined by default

{
"resource.resolver.mapping": [
"/content/${appId}/</", "/:/"
]
}

 



Arun Patidar

Avatar

Level 4

Hi @arunpatidar 

I have that config and the default setting looks the same as you mentioned:

YuSheng_0-1677130469992.png

 

Avatar

Correct answer by
Community Advisor

because of this rule, the path is getting trimmed on publish. if you don't have the rewrite rule then you need to remove this config.



Arun Patidar

Avatar

Level 3

I removed the file and still i am having the issue. What is the rewrite rule we should have ?

Avatar

Level 3

RewriteCond %{REQUEST_URI} (.html|.jpe?g|.png|.svg)$ Have this rewrite as well