serve Action #

The serve action can be used to deliver local files to clients. The action implements a simple file server. Optionally, processing of the flow can continue if the content provided by the serve action needs to be modified.

Syntax #

dir and fallback-doc are mandatory:

<flow>
  …
  <serve dir="../htdocs" fallback-doc="/index.html"/>
  …
</flow>

Usage #

The $request/path is resolved relative to dir. If the resolved path references a directory instead of a file, index.html within that directory is used instead. If $request/path references a directory but does not end with a slash (/), a 301 Moved Permanently redirection to the same path with a trailing slash (/) is executed.

If the requested file is found, the following HTTP header fields are set:

The Content-Type is determined by the suffix of the file. The HTTP status code is set to 200 OK.

If the file is not readable, the HTTP status is set to 403 Forbidden.

Errors #

See also #