Closed lbonn closed 5 months ago
Hi and sorry for the delayed reply!
As far as I understand and the documentation describes, layers are only added to routes that already exists, which also applies to fallback routes. As such you should be able to reorder your method calls from .layer(...).fallback(...)
to .fallback(...).layer(...)
and achieve your desired behaviour.
Ah I've missed this bit indeed, makes sense now :)
Thanks a lot!
When adding a 404 fallback route, routes internal to livereload (long-poll, back-up) are eaten up and return 404 as well.
Probably axum only expects middlewares to act on existing routes and not define their own? In that case, not sure how to fix this... Maybe expose the route handlers so that they can be called in explicit routes defined by the user?
Reproduction: apply this patch to the axum-dev-only example