Kemal::Config
Stores all the configuration options for a Kemal application. It's a singleton and you can access it like.
Kemal.config
Constants
Constructors
Instance methods
Adds an error handler for the given HTTP status code
Adds an error handler for the given exception
Maximum number of byte ranges accepted in a single Range request header.
A Range header listing more parts than this is ignored and the full representation
is served with 200 instead. Since send_file also refuses range sets asking for
more bytes in total than the file holds, a multi-range response stays within the
file's own size plus roughly 150 bytes of multipart framing per part. Raising this
therefore raises the framing a single request can ask for; 0 ignores Range
headers entirely and advertises Accept-Ranges: none.
Without a bound, a header such as bytes=0-,0-,0-,... makes the server re-read the
whole file once per range. RFC 9110 §14.2 explicitly allows rejecting such range
sets, as they indicate "either a broken client or a deliberate denial-of-service
attack".
Maximum number of byte ranges accepted in a single Range request header.
A Range header listing more parts than this is ignored and the full representation
is served with 200 instead. Since send_file also refuses range sets asking for
more bytes in total than the file holds, a multi-range response stays within the
file's own size plus roughly 150 bytes of multipart framing per part. Raising this
therefore raises the framing a single request can ask for; 0 ignores Range
headers entirely and advertises Accept-Ranges: none.
Without a bound, a header such as bytes=0-,0-,0-,... makes the server re-read the
whole file once per range. RFC 9110 §14.2 explicitly allows rejecting such range
sets, as they indicate "either a broken client or a deliberate denial-of-service
attack".
WebSocket Origin policy for upgrade requests.
- Empty (default): same-origin —
Originmust match the requestHost(scheme is taken fromOrigin, so TLS termination in front of Kemal still works). Missing or emptyOriginis rejected with 403. - Non-empty allowlist:
Originmust match one of the entries after normalization (scheme/host/port only). MissingOriginis rejected. - Include
"*"to allow any origin, including requests withoutOrigin(previous allow-all behavior). - Use
"null"to allow the browser's opaque"null"origin.
Entries use the serialized origin form, e.g. "https://example.com" or
"http://localhost:3000".
WebSocket Origin policy for upgrade requests.
- Empty (default): same-origin —
Originmust match the requestHost(scheme is taken fromOrigin, so TLS termination in front of Kemal still works). Missing or emptyOriginis rejected with 403. - Non-empty allowlist:
Originmust match one of the entries after normalization (scheme/host/port only). MissingOriginis rejected. - Include
"*"to allow any origin, including requests withoutOrigin(previous allow-all behavior). - Use
"null"to allow the browser's opaque"null"origin.
Entries use the serialized origin form, e.g. "https://example.com" or
"http://localhost:3000".