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

Most upvoted comments

I will try to look into this, if no one else does already.