github graygnuorg/pound v4.19
Version 4.19

12 hours ago

Support for Lua

Functions written in Lua can be used to implement complex request matching conditions, modify requests and/or responses, and implement new backends. You will need Lua version 5.3 or newer. By default, configure will enable Lua support if it finds the necessary headers and libraries. This can be controlled using --disable-lua and --enable-lua options.

At runtime, Lua sources are loaded using Load statement in the Lua global section of the configuration file:

Lua
      Load "impl.lua"
End

A function returning boolean value can be used as a conditional:

   LuaMatch "myfun" "arg"

Any number of arguments (all of string type) can be provided. Arguments undergo usual expansions prior to being passed to the function.

Two more similar statements are added:

  • LuaModify
    Applies a Lua function to modify the request (or response). It can be used in ListenHTTP, ListenHTTPS, Service, Match and Rewrite statements.
  • LuaBackend
    Calls a Lua function that implements a backend.

Detached conditions

A detached condition is a set of conditional statements not associated with any service, which is assigned a unique symbolic name. Detached conditions are defined using the Condition statement in the global
scope of pound configuration file, e.g.:

Condition "protected"
     Path -beg "/admin"
     ACL -file "internal.acl"
     BasicAuth "htpasswd"
End

Detached conditions can be invoked using the Eval statement, which is allowed anyplace where the normal conditional is allowed. Results of evaluation are cached and reused in subsequent Eval statements referring to the same condition. E.g.:

Service
     Eval "protected"
     ...
End

Detached conditions provide a convenient way to define conditional statements with are used repeatedly in multiple Service statements.

New request modification statement: DeleteQuery

Removes query part of the request URL.

One-argument form of SetQueryParam

When used with one argument (name of a query parameter), SetQueryParam causes removal of that query parameter.

Percent encoding and decoding

The Path and QueryParam conditional statements accept new option -decode. When given this option, their value undergoes percent-decoding prior to comparison. E.g.:

QueryParam "t" -decode "?"

Similarly, SetPath and SetQueryParam statements accept new option -encode. When given this option, their value will be percent-encoded prior to setting it.

Relative pathname in SendFile statement

If the argument to SendFile statement is not an absolute file name, it is resolved relative to pound include directory.

Turning PID file off

To disable PID file creation, use

PIDFile "-"

Don't miss a new pound release

NewReleases is sending notifications on new releases.