Serving static files with Kemal (I filed the issue on the Kemal GitHub repo, but got no answer, so I'm reposting my question here)


  • Problem serving local files.
  • I tried the code hereunder, but the local file do not seem to be served.
  • Perhaps my minimalist server is missing an instruction linking the local files to a given route ?

Steps to Reproduce

  1. Code for the server
require "kemal"

IP = ""
PORT = 8081

Kemal.config.port = (ENV["PORT"]? || PORT).to_i
Kemal.config.host_binding = ENV["HOST_BINDING"]? || "#{IP}"
# Kemal.config.env = "production" do |config|
  config.public_folder = "dist"
  1. Compile and run 1.

Expected behavior:
I would expect that when te browser points to or, the content of said index.html page is displayed in the browser.

Actual behavior: Instead, I get:

Hi @serge-hulne

You can use the following to achieve what you want.

public_folder "dist"

IDK why but the config block does not work as intended.

1 Like

Thank you.

1 Like