javalin: Static directories give 404s without adding a trailing slash
Actual behavior (the bug) I’m using Javalin to serve APIs and some static pages. The pages have been registered in the config via:
config.staticFiles.add(staticFile -> {
staticFile.hostedPath = "/display";
staticFile.directory = "/frontend/display";
staticFile.location = Location.CLASSPATH;
});
I’m able to access the page via /display/ and /display/index.html, but using /display it errors out with “404 Not Found”.
I’ve already added config.routing.ignoreTrailingSlashes = true; but it didn’t seem to help.
Expected behavior It should ignore the trailing slash and work as intended
Additional context I’m using Java 11 and Javalin 5.6.1
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- [static-files] Fix erroneous 404 for welcome-file edge-case Fixes #1944 — committed to javalin/javalin by djavorek 9 months ago
- [tests] Add test for welcome files on hosted path closes #1944 — committed to ZJamss/javalin by tipsy 10 months ago
I will try to look into this, if no one else does already.