Module to server directory structure (real of virtual)
Serving static content from directories
This module provides the same functionality as the "http_of_dir" tool. It exposes a directory (and its subdirectories), with the optional ability to delete or upload files.
Lists content of directory. Be careful of security implications.
*)
| Index_or_lists
(*
Redirect to index.html if present and lists content otherwise. This is useful for tilde ("~") directories and other per-user behavior, but be mindful of security implications
*)
| Forbidden
(*
Forbid access to directory. This is suited for serving assets, for example.
*)
behavior of static directory.
This controls what happens when the user requests the path to a directory rather than a file.
add_dirpath ~config ~dir ~prefix server adds route handle to the server to serve static files in dir when url starts with prefix, using the given configuration config. Method is always GET.
This is used to emulate a file system from pure OCaml functions and data, e.g. for resources bundled (totally of partially) inside the web server memory.
An embedded file system, as a list of files with (relative) paths. This is useful in combination with the "simple-httpd-mkfs" tool, which embeds the files it's given into a OCaml module.