Lucas Silva
09/06/2026, 3:17 AMkotlin package isn't serving my web ui correctly. Instead of displaying the HTML file, it's triggering a download because the content type is, for some reason, application/octet-stream . The problem doesn't occur when running with kotlin run though, as the content type stays as html.
The workaround was to add call.respondResource as follows:
get("/") {
call.respondResource("webui/index.html")
}
singlePageApplication {
useResources = true
filesPath = "webui"
defaultPage = "index.html"
}
To be sure this is an issue with KTC, I tried the same in a normal KMP project with Gradle (without the workaround) and it worked just fine with both the buildFatJar and runFatJar tasks.joffrey
09/06/2026, 11:11 PMwebui/index.html declared? Is it in the resources of the Ktor server module? Or in another local module that the server depends on?Lucas Silva
09/07/2026, 12:41 AMktor-backend/resources/webui/index.html. It's a vue frontend built with vite - nothing unusual.joffrey
09/07/2026, 8:37 AMkotlin package is an executable JAR following the Spring Executable JAR format (which contains nested JARs).joffrey
09/07/2026, 8:38 AMjar:nested: protocol to serve resources from this type of JAR: youtrack.jetbrains.com/issue/KTOR-8883
It seems to be implemented already but not released yet. It should be released in Ktor 3.6.0. @Bruce could you please confirm all this?joffrey
09/07/2026, 9:14 AMwebui instead of ignoring it and falling back to the default. @Bruce, is this expected?Bruce
09/07/2026, 10:11 AMLucas Silva
09/09/2026, 1:46 AM3.6.0-eap-1675.joffrey
09/09/2026, 5:27 AMBruce
09/09/2026, 7:05 AMBruce
09/09/2026, 7:07 AMjoffrey
09/09/2026, 8:38 AM