5.4Micro Falcon-based web server

The stand-alone web server is a simple daemon-type application listening on a TCP-IP connection and serving a single site with very basic configuration.

It is meant to serve static files and Falcon scripts. Prospectively, it is thought to become a primary mean for falcon-based web sites to distribute content on the net, but in this first release of WOPI it should be considered experimental and suitable for local testing of WOPI sites.

Command line

The micro web server is started from a program called falhttpd (or falhttpd.exe). Some minimal configuration options can be specified on the command line, while more in depth options and MIME type mappings can be specified in a configuration file.

When two options are specified both on the command line and on the configuration file, the command line setting is prioritized (overrides the configuration file setting).

- -?: Prints a short in-line help of configuration options.

Configuration file

The configuration file allows a better control of some options.

It's structured as a pair of "key = value" entries; "#" marks a comment line.

Recognized keys are:

- HomeDir: Home directory of the served site.

Mime types configuration

The falhttpd server determines the mime type of the files it serves via a configuration "category" called "mime". The mime type served to the client is the part of the key past the first dot, and each dot is then transformed into a "/" separator. The Value associated with each key is a single wildcard or multiple wildcards separated by ";", matching the files that should be served with the specified mime type.

For example, to have documents with an .htm or .html extension served as "text/html", you should use the following entry:


   mime.text.html = "*.htm;*.html"

Scripts (fal, fam and ftd) can control their own mime type, so they can't be addressed by this mapping.

As set of minimal entries (for html, images, css and javascript) is built-in on the falhttpd, and will be disabled if mime entries are specified in the configuration file.

Virtual paths

Falhttpd supports virtual paths, or in other words, the ability to redirect all the requests for URI below a certain directory to a single script which has then the role of interpreting that URI as a request.

To establish a virtual path, the vpath configuration category must be used. The rest of the key represents the topmost entry in the virtual path, while the value is the script to be launched (relative to the start directory).

For example, the following entry:


   vpath.myroot.* = welcome.fal

will redirect every request below the URI "/myroot/" to the script "welcome.fal". Script path is relative to the directory where falhttpd is started, and can be anywhere in the system (they're not confined to the site area).

The script can determine the original URI stored in the request through the appropriate field in the Request object.

Made with http://www.falconpl.org