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

SOLVED

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

Gunjan_13
Level 2
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
asutosh_jena
Correct answer by
Community Advisor
Community Advisor
4 Replies
asutosh_jena
Community Advisor
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!

Gunjan_13
Level 2
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. 

Gunjan_13
Level 2
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. 

asutosh_jena
Correct answer by
Community Advisor
Community Advisor