A handler that lists directories and serves files under a given public directory.
This handler can send precompressed content, if the client accepts it, and a file with the same name and .gz extension appended is found in the same directory. Precompressed files are only served if they are newer than the original file.
NOTE To use StaticFileHandler, you must explicitly import it with require "http"
Creates a handler that will serve files in the given public_dir, after expanding it (using File#expand_path).
Creates a handler that will serve files in the given public_dir, after expanding it (using File#expand_path).
DEPRECATED
HTTP::Handler
Reference
Reference
Reference
Object
Object
Object
Creates a handler that will serve files in the given public_dir, after expanding it (using File#expand_path).
If fallthrough is false, this handler does not call next handler when request method is neither GET or HEAD, then serves 405 Method Not Allowed. Otherwise, it calls next handler.
If directory_listing is false, directory listing is disabled. This means that paths matching directories are ignored and next handler is called.
Creates a handler that will serve files in the given public_dir, after expanding it (using File#expand_path).
If fallthrough is false, this handler does not call next handler when request method is neither GET or HEAD, then serves 405 Method Not Allowed. Otherwise, it calls next handler.
If directory_listing is false, directory listing is disabled. This means that paths matching directories are ignored and next handler is called.
DEPRECATED
© 2012–2026 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/1.19.0/HTTP/StaticFileHandler.html