Expand my Community achievements bar.

404 Error handling in AEM SPA

Avatar

Level 7

When a abc page is not found, then apache internally makes the request to 404-error-page.html(based on error directive), and I see a request for abc.model.json and en.model.json in the network tab, but I don’t see the request for 404-error-page.model.json (because html redirect is made internally by Apache). Due to which page is showing blank. 

 

Apache Error directive configuration

ErrorDocument 404 /content/en/us/error/404-error-page.html

2 Replies

Avatar

Employee

Hi,

Since the request for 404-error-page.model.json is not being made, it could be possible that the model for the 404 error page is not being initialized properly.

One possible solution is to explicitly initialize the model for the 404 error page in the 404-error-page.html file. You can do this by including a script tag in the HTML file that initializes the model for the page.

Avatar

Level 7

Hi @ManviSharma 

 

Can you please share one sample script. It would help a lot.

page footer