Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

[React] How do we handle 404 error AEM SPA editor? #80

Open
khus29 opened this issue Feb 4, 2020 · 2 comments
Open

[React] How do we handle 404 error AEM SPA editor? #80

khus29 opened this issue Feb 4, 2020 · 2 comments
Assignees

Comments

@khus29
Copy link

khus29 commented Feb 4, 2020

Local Environment
Before filing an issue, verify that the prerequisite tools/software are installed:

  • AEM 6.5 + SP2
  • Java 1.8
  • Apache Maven (3.3.9 or newer)
  • Node.js v10+
  • npm 6+

Describe the issue
If user hit any route which does not exists, 404 error, then how do we handle it? What is the standard way to handle it - at AEM end or at react end?

@viveksachdeva
Copy link

viveksachdeva commented Mar 2, 2020

Hi,

are there any recommendations or documentation around this? ACS commons error handler doesnt work with this

@viveksachdeva
Copy link

I got it to work using ACS Error handler with some modification in 404.jsp...
The issue is that error handler returns path of 404 page as <404page>.html irrespective of the whether originating request is from HTML, or JSON..
In case of SPA, any junk url gets internally redirected to 404.html which calls its model.json for data which again is a junk URL and gets redirected to 404.html instead of 404.model.json,. We want 404.model.json to be a normal request returing JSON data.. Doing this made 404 page render perfectly..

Hope this helps :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants