Expand my Community achievements bar.

SOLVED

[AEM SPA | React] 2 calls for model.json ; page content is loading twice

Avatar

Level 2

I am facing issue in AEM SPA. This issue is on home page, there are 2 calls like below 

 

Gunjan_13_0-1631690305534.png

This issue occurs on publisher, whereas on dispatcher the page comes blank. Can someone please help to resolve this issue. 

Note :

1. Rest other pages are loading fine. 

2. On dispatcher I have URL shortening rules and on publisher I am resource resolver config. 

3. While testing I observe, that If I add some some character (dot or anything) on customheaderlibs.html, page work fine on both publisher & dispatcher.  

4. I have overridden the HierarchyPageImpl to handle the URL shortening to give short path for all children element. 

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor
4 Replies

Avatar

Community Advisor

Hi @Gunjan_13 

 

It should not make the 2nd call. Looks like something wrong with the URL shortening with the resource resolver map configuration. Can you please share the rules that you applied for URL shortening?

 

Thanks!

Avatar

Level 2

Hi @Asutosh_Jena_ 

thanks for looking into. 

 

I am using resource resolver factory config at publisher. 

 

"resource.resolver.mapping": [

"/:/","/content/sample-project/en/:/","/content/sample-project/my/:/"


]

* failing at publisher already * 

and then rewriting at dispatcher. 

Avatar

Level 2


#Trim off the .html from URI
RewriteCond %{REQUEST_URI} \.html$
RewriteRule ^/(.*).html$ /$1 [R=301,L,QSA]

 

# Shorten the Tenant Path without extension
RewriteRule ^/content/${CONTENT_FOLDER_NAME}/en/([^.]*)$ /$1 [R=301,L]

 

# Add html to the URI before sending to publisher.
RewriteCond %{REQUEST_URI} !^/apps
RewriteCond %{REQUEST_URI} !^/bin
RewriteCond %{REQUEST_URI} !^/content
RewriteCond %{REQUEST_URI} !^/etc
RewriteCond %{REQUEST_URI} !^/home
RewriteCond %{REQUEST_URI} !^/libs
RewriteCond %{REQUEST_URI} !^/saml_login
RewriteCond %{REQUEST_URI} !^/favicon.ico
RewriteCond %{REQUEST_URI} !^/system
RewriteCond %{REQUEST_URI} !^/tmp
RewriteCond %{REQUEST_URI} !^/var
RewriteCond %{REQUEST_URI} !(.json|.jpe?g|.png|.svg|.JPG|.mp4|.mov)$
RewriteRule ^(/.*)$ $1.html [L,PT]

 

 

May I know on publisher, instead of resource resolver can I use anything else ? I tried etc mapping but dint work for me. may be something wrong which I did there. can you please share any sample if any. 

Avatar

Correct answer by
Community Advisor