What is the best way to serve up proper 404's with an AngularJS app?
A little background: I'm building an Angular app and have opted to use
$locationProvider.html5Mode(true);
because I want the URLs to appear natural (and indistinguishable from a multi-page "traditional" web app).
On the server side (a simple Python Flask app), I have a catch-all handler that redirects everything to the angular app:
@app.route('/', defaults={'path': ''})
@app.route('/<path>')
def index(path):
return make_response(open('Ang/templates/index.html').read())
Now, I'm trying to figure out what to do with 404 errors. Most of the Angular apps I've seen do the following:
.otherwise({ redirectTo: '/' })
which means that there is no way they can serve up a proper 404.
However, I would much rather return a proper 404, with a 404 status code (mainly for SEO purposes).
What is the best way to handle 404s with Angular? Should I not worry about it and stick with a catch-all? Or should I remove the catch-all and serve up proper 404's on the server side?
edited for clarity