Expand my Community achievements bar.

SOLVED

SPA page is not showing content for a domain page

Avatar

Level 2

We have a site structure like 

/content/brand/us/en/home-page.html

and   

/content/brand/us/web/home-page.html

 

pages under en are created by using slightly

pages under we bare SPA pages using SPA components

 

current home page for our domain is under en and it is loading properly , we used below rewrite rule for this

RewriteRule ^/?$ /content/brand/us/en/home-page.html [QSA,PT,L]

 

now we are changing home page to a SPA page under web , we are using  below rewrite rule for this

RewriteRule ^/?$ /content/brand/us/web/home-page.html [QSA,PT,L]

 

now after changing  when we hit our domain URL in publisher it is not loading content giving blank page

https://publish-yyyyy.adobeaemcloud.com

 

but if i hit the whole URL for this homepage , it is showing content

https://publish-yyyy.adobeaemcloud.com/content/brand/us/web/home-page.html

 

in working page when we hit full page path , seeing css and js clientlibs files

Vishnu9_0-1722000280261.png

 

 

if we hit domain url directly then css and js files are not getting loaded 

Vishnu9_1-1722000347699.png

 

 

these css and js files for other SPA pages are loading properly when we hit them with direct URL 

or though other rewrite rules like below  we are able to access other pages

RewriteRule ^/business/abc$ /content/brand/us/web/business/abc.html [QSA,PT,L]

 

only when domain page is accessed directly , css and js is not loading 

 

Please advice if anything needs to be checked and added in dispatcher or any configuration i need to enable when loading SPA page

 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi, 

If you access the SPA URL directly through the dispatcher (the full path), is the application loading? If not, check which resources are being blocked by using the Network tab in the browser. Then, review the dispatcher logs to understand what type of redirect is occurring and address it. Once you fix that, you can add the redirect and do the same exercise. 

 

Hope this helps



Esteban Bustamante

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi, 

If you access the SPA URL directly through the dispatcher (the full path), is the application loading? If not, check which resources are being blocked by using the Network tab in the browser. Then, review the dispatcher logs to understand what type of redirect is occurring and address it. Once you fix that, you can add the redirect and do the same exercise. 

 

Hope this helps



Esteban Bustamante

Avatar

Level 6

It looks like your issue might be related to the base path for your CSS and JS files when the SPA is accessed through the rewrite rule. Try below steps to troubleshoot and see if this resolves your issue:

1- Check Base Path Configuration: Ensure that the base path for your CSS and JS files is correctly set in your SPA. When using a rewrite rule to access the SPA, the base path might need to be adjusted.

2- Dispatcher Configuration:

Ensure Filters Are Set Correctly- Check your dispatcher configuration to ensure that the paths to your CSS and JS files are not being blocked by any filters.

Cache Configuration-  Make sure the dispatcher cache is configured to cache and deliver your SPA assets correctly. This includes paths for CSS, JS, and other static assets.

Rewrite Rules: Verify that your rewrite rules are not accidentally affecting the paths to your CSS and JS files. Sometimes, additional rules might be needed to handle asset paths correctly.

Try Network Inspection: Use browser developer tools to inspect the network requests for CSS and JS files. Check the console for any 404 errors or other issues that might indicate why the assets are not being loaded.

Base Tag in HTML: If not already done, ensure the base tag in your HTML points to the correct path. like <base href="/content/brand/us/web/">

Try something below for adjusted rewrite rule considering base path issues:

RewriteRule ^/?$ /content/brand/us/web/home-page.html [QSA,PT,L]

You can also try setting a more specific rule to handle the base path for assets (css/js):

RewriteRule ^/assets/(.*) /content/brand/us/web/assets/$1 [L]

If the problem persists, you may need to dive deeper into the dispatcher logs and AEM error logs to find more specific information about what might be causing the issue. 

Hope this helps.

Avatar

Level 2

Not sure what is the issue with the original template.

But issue resolved after using new template  created with SPA Root base page