benwaar
benwaar

Reputation: 39

Why are custom 404 handlers not supported in Google App Engine?

I'd like to send a 404 error, and re-direct to a more attractive Error page for the user on Google App Engine.

I've tried adding this to my web.xml, but it doesn't work

    <error-page>
    <error-code>404</error-code>
    <location>404.html</location>
    </error-page>

The only information I have discovered comes from the old Google group

https://groups.google.com/d/topic/google-appengine-java/3C-pY5ta2HQ/discussion

I'd like to send the proper 404 header for search engines, and I'd like to present a nicer Error message to the user. Jason's suggestion at the end would mean sending a 302 and not a 404 so I don't think that is ideal for search engines. Is that the only choice? Any help, views appreciated.

Upvotes: 4

Views: 867

Answers (1)

Nick Johnson
Nick Johnson

Reputation: 101149

Custom 404 pages are not supported for URLs your app handles, because once the request is directed to your application, it's up to it to return the response to the user. If you want to render an attractive 404 page, you should have your app return that as its response to a request that generates a 404. How you do that - via an internal redirect (not an HTTP one!) - or other functionality is up to you.

Upvotes: 3

Related Questions