When any endpoint in XWiki produce a 404, it gets redirected to /bin/view/Main/DocumentDoesNotExist.
While it makes sense for a page, it actually generally cause problems for other endpoints.
See https://forum.xwiki.org/t/get-rid-of-the-auto-servlet-redirect-in-case-of-404/17293 for more details.