Hi xwikiiers,
When any endpoint in XWiki produce a 404, it gets redirected (it’s a Servlet internal redirect, not a full HTTP redirect) to /bin/view/Main/DocumentDoesNotExist.
While it makes sense for a page, it actually generally cause problems for other endpoints:
- they cannot send back custom content (unless they force a flush, but then it will produce warnings when DocumentDoesNotExist is executed)
- it also causes quite a few problems in some endpoints for which not everything is properly initialized for
/bin/view/Main/DocumentDoesNotExistto work (which is actually most endpoints) - it can cause major performance problems when a lot of queries are targeting not existing (web, rest, etc.) resources since it’s a lot more expensive than just returning a simple HTTP 404 (with sometime a very small custom content)
I actually noticed that `XWikiAction` have a “native” error handling which produce the exact same end result by default (executing “docdoesnotexist” template) so mostly the same thing is done twice. It also has the added bonus that it’s done in a more accurate context (the page which does not exist) and it’s of course also much better for performance to do that only once.
So I propose to simply get rid of the global 404 redirect in web.xml.
The only downside is that it won’t be possible to customize that using a Main.DocumentDoesNotExist page anymore (which is a regression). But you can still very easily customize the display of a not existing pages, through a wiki template for docdoesnotexist.vm.
- Remove that in master
- Remove that also in LTS branches
WDYT ?
Here is my +1 for 1. and +0 for 2.. It is technically a regression, but the feature still exist and I doubt it’s done much anyway.