This repository has been archived by the owner on Aug 30, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2k
Page not found handler not working in 0.4.0 #501
Comments
Since we are using html5-mode routes, angular is responsible for showing 404 pages for most routes, right? // Return a 404 for all undefined api, module or lib routes
app.route('/:url(api|modules|lib)/*').get(core.renderNotFound); and either keep the redirect for everything else or implement angular based 404 logic as well. |
simison
added a commit
to simison/mean
that referenced
this issue
May 18, 2015
… into error-404-pages
simison
added a commit
to simison/mean
that referenced
this issue
May 18, 2015
- `/{api|modules|lib}/*` returns error page when path doesn’t exist (from Express). - `/*` always returns index (from Express), but if `$state` doesn’t exist, Angular redirects to `/not-found` (no 404 status in that case though!) - If `Accept: application/json` header is present without `Accept: text/html`, return error as json. Hence looking at non existing /api/* paths with browser would show html error, but querying them with script would return json. - Slightly prettier 404 error Test: ```bash curl http://localhost:3000/api/notfound -4 -H "Accept: application/json" ``` => json error. ```bash curl http://localhost:3000/api/notfound -4 -H "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0 .8" ``` => html error (imitates Chrome’s Accept header). Starting point was @dotch’s PL: meanjs#503 And `req.accepts()` idea came from http://stackoverflow.com/a/9802006
simison
added a commit
to simison/mean
that referenced
this issue
May 18, 2015
lirantal
added a commit
that referenced
this issue
Jul 20, 2015
#501 Handle 404 errors at Express backend and at Angular frontend
I assume we can close this now that we merged #566 ? |
I've verified this is working after merging #566. The app is responding with the not-found route on the front-end, when a non existing route is requested. |
Verified. Let's close. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Steps to reproduce:
npm install
;grunt
;Expected result:
Actual result:
If I remove the "*" from the last route of modules/core/server/routes/core.server.routes.js, the 404 functionality is restored; however, sign up, sign in and pretty much everything else is broken, because of the fallback to the error routes defined in config/lib/express.js. I haven't yet found what the correct fix is.
I noticed the issue on my own testing application, when the server not only produced a 200 status code, but also the HTML content of the root page, when requested an image which wasn't there.
The text was updated successfully, but these errors were encountered: