https://kotlinlang.org logo
#kobweb
Title
# kobweb
h

hamyn

10/04/2023, 12:05 PM
Hey, I noticed something odd. I have a page defined under a directory with no modifications to
@Page
, like the one shown in the readme: "`.../pages/admin/Index.kt` ". The thing is, in development mode, everything works fine but when I export the project as a static site and run kobweb on it with said command, I get 404 when I try to visit
/admin/
only when it ends with a slash. But it's fine in development mode. What am I missing here ? P.S. I have `div`s with ids that I link to for better UX like
<http://site.com/admin/#element-3|site.com/admin/#element-3>
and also if it helps, I'm using @Vaibhav's shadcn/ui port instead of Silk.
d

David Herman

10/04/2023, 3:36 PM
Ha just a coincidence but I'm fixing that right now, found it myself last night
Turns out ktor's
staticFiles
implementation sucks
in this one edge case
(in my opinion)
😄 2
In dev mode, we have a bunch of rich custom logic around serving files (and handling live reloading), but in prod for static layout projects, we simplify the code a lot by delegating that to ktor.
According to their docs it should have handled this case but it does not seem to out of the box and needs to be configured.
If you set your version to 0.14.2-SNAPSHOT, the trailing slash issue should be fixed!
h

hamyn

10/05/2023, 12:13 AM
Thanks, it works now
👍 2