This is pound.info, produced by makeinfo version 6.8 from pound.texi.

Copyright (C) 2024-2025 Sergey Poznyakoff

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.3 or any later version published by the Free Software
     Foundation; with no Invariant Sections, no Front-Cover Texts, and
     no Back-Cover Texts.  A copy of the license is included in the
     section entitled "GNU Free Documentation License."
INFO-DIR-SECTION Network applications
START-INFO-DIR-ENTRY
* pound: (pound).        Light-weight proxy server.
* poundctl: (pound).     Pound proxy server runtime control.
END-INFO-DIR-ENTRY


File: pound.info,  Node: Top,  Next: Overview,  Up: (dir)

Pound
*****

This edition of the 'Pound Manual', last updated 30 November 2025,
documents 'pound' version 4.19.

   Copyright (C) 2024-2025 Sergey Poznyakoff

     Permission is granted to copy, distribute and/or modify this
     document under the terms of the GNU Free Documentation License,
     Version 1.3 or any later version published by the Free Software
     Foundation; with no Invariant Sections, no Front-Cover Texts, and
     no Back-Cover Texts.  A copy of the license is included in the
     section entitled "GNU Free Documentation License."

* Menu:

* Overview::
* Introduction::
* Usage::
* Simple Proxy::
* HTTPS::
* Balancer::
* Worker model::
* Lua::
* Logging::
* Configuration::
* poundctl::
* Emacs::
* Metric Families::
* Time and Date Formats::
* Old Control Format::
* GNU Free Documentation License::
* Example Lua modules::
* Index::

 -- The Detailed Node Listing --

Simple Proxy

* Service selection::
* Request modifications::
* Conditional branches::
* Modifying responses::
* Authentication::
* Rate-limiting::
* Redirects::
* Error responses::

Service Selection

* Regular Expressions::
* File-based Conditions::
* ACL::
* Detached Conditions::

HTTPS

* ACME::
* Redirect HTTP to HTTPS::
* HTTPS backends::

Request balancing

* Sessions::
* Balancer groups::
* Dynamic backends::

Extending 'pound' functionality with Lua

* LuaLoad::    Loading Lua sources.
* LuaMatch::   Lua conditionals.
* LuaModify::  Changing requests and responses in Lua.
* Stash::      Sharing data between Lua functions.
* LuaBackend:: Lua backends.
* Lua API::

Changing requests and responses in Lua

* Cookie injection::

Configuration

* Lexical structure::
* Syntax::
* String Expansions::
* Global directives::
* File inclusion::
* Logging configuration::
* Management interface::
* Timeouts::
* ListenHTTP::
* ListenHTTPS::
* Service::
* resolver::

String Expansions

* Backreference Expansion::
* Request Accessors::

Global directives

* Runtime directives::
* Worker Settings::
* Proxy Tuning::
* SSL Settings::
* Regexp Settings::
* ACL definition::
* Condition::
* Lua Settings::

Management Interface

* Service Control::

ListenHTTP

* Listener address::
* Listener-specific limits::
* Error definitions::
* Listener logging::
* Request Modification::
* Response Modification::
* Error response rewriting::
* Service definitions::

Request Modification

* Rewrite::

Response Modification

* rewrite response::

Service

* Service Selection Statements::
* Service Request and Response Modification::
* Service Logging::
* Backends::
* Session::
* Other Statements::

Backends

* Backend::
* UseBackend::
* Special Backends::

poundctl

* poundctl commands::
* poundctl remote::
* poundctl config::
* poundctl options::
* poundctl template::

Configuring 'poundctl'

* multiple servers::

'poundctl' template

* Template syntax::
* Pipelines::
* Variables::
* Input object::

Template syntax

* Actions::
* Arguments::

Input object

* Core listing::
* Full listing::
* Listener object::
* Service object::
* Backend object::

Example Lua modules

* jwt.lua::
* cookie.lua::



File: pound.info,  Node: Overview,  Next: Introduction,  Prev: Top,  Up: Top

1 Overview
**********

'Pound' is a reverse proxy, load balancer and HTTPS front-end for Web
servers.  It was developed to provide for even distribution of load
between backend httpd servers and to allow for a convenient SSL wrapper
for those servers that do not offer it natively.

   The core principles of its design are simplicity and safety.  'Pound'
is a very small program, easily audited for security problems.  Normally
it runs as a non-privileged user, and can optionally be run in a
chrooted environment.  With several exceptions, it does not access the
hard disk during its runtime.  In short, it should pose no security
threat to the server it runs at.

   The original version of 'pound' was written by Robert Segall at Apsis
GmbH(1). In 2018, I added support for newer OpenSSL to the then current
version of the program (2.8).  This version of 'pound', hosted on
'github' was further modified by Rick O'Sullivan and Frank Schmirler,
who added WebSocket support.

   On April 2020, Apsis started development of 'pound' 3.0 - essentially
an attempt to rewrite program from scratch, introducing dependencies on
some third-party software.

   On 2022-09-19, the development and maintenance of 'pound' was
officially discontinued and Apsis GmbH was dissolved.  Following that, I
decided to continue development of the program taking my fork as a base.
I considered the branch 3.0, which emerged for a short time before the
original project was abandoned, to be a failed experiment.  To ensure
consistent versioning and avoid confusion, my versioning of 'pound'
started at number 4.0.

   ---------- Footnotes ----------

   (1) <https://web.archive.org/web/20221202094441/https://apsis.ch/>


File: pound.info,  Node: Introduction,  Next: Usage,  Prev: Overview,  Up: Top

2 Introduction
**************

The job of a proxy server is to receive incoming HTTP or HTTPS requests,
route them to the corresponding web server ("backend"), wait for it to
reply and forward the response back to the querying party.  If more than
one backend is configured to serve requests, the proxy should distribute
requests evenly between them, so that each backend gets a share of
requests proportional to its capacity.

   'Pound' gets information about backends and instructions on HTTP
request routing from its configuration file 'pound.cfg'.  It is located
in the "system configuration directory", which is normally '/etc'(1).
Syntactically, the configuration file is a sequence of "statements" and
"sections", separated by arbitrary amount of empty lines and comments.
A "simple statement" occupies a single line and consists of a keyword
("directive") and one or more values separated by whitespace.  A
"section" is a compound statement that encloses other statements and
sections.  Sections begin with a keyword, optionally followed by
arguments, and end with a word 'End' on a line by itself.  All keywords
are case-insensitive.

   The configuration file defines three kinds of objects: "listeners",
"services", and "backends".  These are defined as configuration
sections.

   A "listener" defines IP address (and optionally port), 'pound' will
be listening on for incoming requests.  It can also be regarded as a
frontend definition.  Listener declarations start with 'ListenHTTP' (for
plaintext HTTP frontends) or 'ListenHTTPS' (for HTTPS frontends)
keywords.

   "Service" sections define rules that decide to which backend to route
requests received by the listeners.  These rules normally involve
analysis of the requested URL or HTTP headers.  A service may also
contain statements that modify requests or responses.

   Services are normally declared inside listeners.  Thus, when a
listener receives a request, it iterates over its services (in the order
of their appearance in the configuration file) to find the one that
matches the request.  If such a service is found, it receives the
request and eventually passes it on to a backend.

   Services may also be declared outside any listeners, in the global
scope.  Such services are shared between all listeners.  They are tried
if none of the services declared within a listener match the incoming
request.

   Service declarations start with the 'Service' keyword.

   "Backends" are objects that actually handle requests and produce
responses.  Most often these are "regular backends", which declare IP
addresses and ports of servers that are to handle the requests.
Backends are defined inside of services, so that the service that
matched the request routes it to its backend.  If more than one backend
is defined within a service, incoming requests will be distributed so
that each backend gets its share of the load.

   Several special backend types are provided, such as emergency
backends, redirects, etc.  Only one special backend can be declared for
a service, and it cannot be used together with other backend types.

   Thus, an average request processing looks as follows.  First, a
request is received by one of the listeners.  The listener then iterates
over its services, until it finds one that matches the request.  If no
such service was found, the listener retries the process with the
services defined in the global scope.  If no matching service is found,
a 503 error ('Service Unavailable') is returned.  Otherwise, if the
matching service was found, that service passes the request to one of
its backends.  It may modify the request before that, if it is
instructed so by the configuration.  Once the backend responds, the
service passes the response back to the listener (again, optionally
modifying it, if needed), which finally passes it back to the querying
party.

   ---------- Footnotes ----------

   (1) The exact location depends on compilation options.  When in
doubt, examine the output of 'pound -V'.


File: pound.info,  Node: Usage,  Next: Simple Proxy,  Prev: Introduction,  Up: Top

3 Usage
*******

When started, 'pound' first parses its configuration file.  If any
errors are detected at this stage, it prints the appropriate diagnostics
on the standard error and exits with code 1.  Otherwise, if the
configuration file is OK, 'pound' opens sockets declared in the listener
sections, detaches itself from the controlling terminal and starts
serving incoming requests.  From that moment on, all diagnostic messages
are reported via 'syslog' (*note Logging::).

   To check whether the configuration file is correct, run 'pound' with
the '-c' (for "check") configuration option:

     pound -c

   Started this way, 'pound' will check the configuration file, report
any errors, if found, and exit with status 0 if there are no errors or 1
otherwise.  The option '-v' can be used to increase the verbosity level.
In particular, it instructs 'pound' to print a confirmation message on
standard error, if no errors have been encountered (by default it would
exit silently in this case).

   To use alternative configuration file, supply its full pathname with
the '-f' option, e.g.:

     pound -f /etc/pound/test.cfg

   If you are experimenting with new configurations, you might want to
run 'pound' in foreground mode and have it print its diagnostics on the
standard error.  This is done by the '-e' option.  So, for testing
purposes, it is quite common to start it this way:

     pound -e

   Another option, '-F', has similar effect, except that it honors
logging settings from the configuration file (*note Logging::), i.e.
when used with this option, 'pound' will remain in foreground, but will
report its messages in accordance with its configuration file.

   The following table summarizes all command line options:

'-c'
     Check configuration file for syntax error and exit.  Exit code
     indicates whether the configuration is OK (0) or not (1).

'-e'
     Start in foreground mode and log to standard error (or standard
     output, for messages with LOG_DEBUG and LOG_INFO severity levels).
     This option ignores the 'LogLevel' configuration setting (*note
     Logging::).

'-F'
     Foreground mode.  Do not detach from the controlling terminal after
     startup, but remain in the foreground instead.  This overrides the
     'Daemon' configuration setting (*note Daemon::).  The log stream
     (syslog facility or stderr) requested in the configuration file
     remains in effect.

'-f FILE'
     Read configuration from the supplied FILE, instead of from the
     default location.

'-h'
     Print short command line usage summary and exit.

'-p FILE'
     Sets location of the "PID file".  This is the file where 'pound'
     will write its PID after startup.  This option overrides the value
     set by the 'PIDFile' configuration setting (*note PIDFile::).  Use
     '-p -' to disable creation of PID file.

'-v'
     Verbose mode.  During startup, error messages will be sent to
     stderr (stdout, for 'LOG_DEBUG' and 'LOG_INFO' severities).  If
     'pound' is configured to log to syslog, error diagnostics will be
     duplicated there as well.  After startup the configuration settings
     take effect.

     When used with '-c' this option also instructs 'pound' to print an
     extra confirmation message on standard error, if there are no
     errors in the configuration file.

'-V'
     Print program version, licensing terms, and configuration flags and
     exit with status 0.  You can use this option, in particular, to get
     the default values 'pound' was built with, such as e.g.
     configuration file location.

'-W FEATURE'
'-W no-FEATURE'
     Enable or disable (if prefixed with 'no-') additional 'pound'
     features.  As of version 4.19, the following features are
     implemented:

      -- Feature: warn-deprecated
          When parsing the configuration file, warn if it uses any
          deprecated statements.  This is the default.  To suppress
          deprecation messages, use '-W no-warn-deprecated'.

      -- Feature: dns
          Resolve host names found in configuration file and returned in
          the 'Location:' header.  This is the default.

          You can use '-W no-dns' to disable it, in order to suppress
          potentially lengthy network host address lookups.  Make sure
          that your configuration file refers to backends only by their
          IP addresses in this case.

          This setting affects also redirection location rewriting:
          *Note RewriteLocation: Response Modification.

      -- Feature: include-dir=DIR
      -- Feature: no-include-dir
          This controls the "include directory", i.e.  the directory
          where 'pound' looks for relative file names referred to in its
          configuration file.  *Note include directory::, for a detailed
          discussion of this feature.

          Using '-W include-dir=DIR' sets the new value of the include
          directory.

          By default, the system configuration directory is used as
          include directory, so that any relative file names are looked
          up there.  To disable this, use the '-W no-include-dir'
          option.  This means that each relative filename used in
          arguments to the directives in the configuration file will be
          looked up in the current working directory.  This is useful
          mainly in testsuite.


File: pound.info,  Node: Simple Proxy,  Next: HTTPS,  Prev: Usage,  Up: Top

4 Simple Proxy
**************

In this chapter we will deploy several simplest proxying configurations
to illustrate the concepts introduced above.

   Suppose you have an HTTP server running on localhost port 8080, and
want to make it accessible from outside.  This is achieved by the
following configuration file:

     ListenHTTP
         Address 0.0.0.0
         Port 80
         Service
             Backend
                 Address 127.0.0.1
                 Port 8080
             End
         End
     End

   This configuration consists of three nested sections: 'ListenHTTP',
'Service', and 'Backend'.  Each section ends with a keyword 'End' on a
line by itself.

   The first thing that draws attention are 'Address' and 'Port'
statements appearing in both listener and backend sections.  In
'ListenHTTP' they specify the IP address and port to listen on for
incoming requests.  Address '0.0.0.0' stands for all available IP
addresses(1).  In 'Backend' section, these keywords specify the address
and port of the remote server, where incoming requests are to be
forwarded.

   The 'Service' section has no conditional statements, so it will apply
to all requests.

* Menu:

* Service selection::
* Request modifications::
* Conditional branches::
* Modifying responses::
* Authentication::
* Rate-limiting::
* Redirects::
* Error responses::

   ---------- Footnotes ----------

   (1) Strictly speaking, for all available _IPv4_ addresses.  To bind
to all available IPv4 and IPv6 addresses, use '::0'.


File: pound.info,  Node: Service selection,  Next: Request modifications,  Up: Simple Proxy

4.1 Service Selection
=====================

Multiple services can be defined in order to route requests to different
servers, depending on the request content.  In this case, each service
has one or more "conditional statements" ("conditionals", for short),
that define conditions which a request must match in order to be routed
to backends within that particular service.  Syntactically, such
conditionals have the form:

     KW [OPTIONS] "PATTERN"

where KW is a keyword specifying what part of the request is used in
comparison, PATTERN is a textual pattern which that part is matched
against, and OPTIONS are zero or more flags starting with a dash sign,
which define matching algorithm.

   Perhaps the most often used condition is 'Host', which compares the
value of the HTTP 'Host' header with the given pattern.  By default it
uses exact case-insensitive match:

     Host "example.com"

   To treat the pattern as a regular expression, use the '-re' option,
as in:

     Host -re ".*\\.example\\.com"

   Whenever we speak about regular expression we usually mean POSIX
extended regular expressions (*note POSIX extended regular expressions:
(sed)Extended regexps.).  However, other regex types can also be used.
This is covered in *note Regular Expressions::.

   Notice the use of double backslashes in the above example.  The
backslash before each dot is needed to match it literally, while another
one protects the first one from being interpreted as an escape character
in string (*note Strings::).

   Other useful options are '-beg' and '-end', which enable exact
matching at the beginning and end of the value, correspondingly.  Thus,
the 'Host' statement above can be rewritten as:

     Host -end ".example.com"

   The set of options available for use in conditions is uniform.  *Note
conditional-option::, for a detailed discussion of available options.

   The following configuration snippet illustrates the use of conditions
to select appropriate service (and, correspondingly, backend).  It will
route all requests for 'www.example.com' to backend '192.0.2.1:8080',
and requests for 'admin.example.com' to '192.0.2.4:8080':

     ListenHTTP
         Address 0.0.0.0
         Port 80

         Service
             Host "www.example.com"
             Backend
                 Address 192.0.2.1
                 Port 8080
             End
         End

         Service
             Host "admin.example.com"
             Backend
                 Address 192.0.2.4
                 Port 8080
             End
         End
     End

   Other conditions use POSIX regexp matching by default.  These are:

'Header'
     Compare HTTP header against a pattern.  E.g.

          Header "Content-Type:[[:space:]]*text/.*"

'URL'
     Match URL:

          URL "/login/.*&name=.*"

'Path'
     Match the path part of the URL:

          Path -beg "/login"

'Query'
     Match the query part of the URL.

'QueryParam'
     Match the value of a query parameter.  This statement takes two
     arguments: parameter name and pattern, e.g.:

          QueryParam "type" "(int)|(bool)"

   *Note Service Selection Statements::, for a detailed description of
these and other conditions.

   Multiple conditions can be used together.  Unless expressly specified
otherwise, they are joined by logical 'and' operation.  For example:

     Service
         Host "www.example.com"
         URL "^/admin(/.*)?"
         Backend
             Address 192.0.2.4
             Port 8080
         End
     End

   This service will be used for requests directed to host name
'www.example.com' whose URL begins with '/admin', optionally followed by
more path components (such as, e.g.
'http://www.example.com/admin/login').

   To select a service that matches one of defined rules (i.e.  combine
the rules using logical 'or'), enclose them in 'Match OR' block, as in:

     Match OR
         Host "example.com"
         Host "www.example.com"
     End

   The argument to 'Match' can be 'OR' or 'AND', specifying logical
operation to be used to join the enclosed statements.  The argument can
be omitted, in which case 'AND' is implied.  'Match' statements can be
nested to arbitrary depth, which allows for defining criteria of
arbitrary complexity.  For example:

     Service
         Match OR
             Host "admin.example.com"
             Match AND
                 Host "www.example.com"
                 URL "^/admin(/.*)?"
             End
         End
         Backend
             Address 192.0.2.4
             Port 8080
         End
     End

* Menu:

* Regular Expressions::
* File-based Conditions::
* ACL::
* Detached Conditions::


File: pound.info,  Node: Regular Expressions,  Next: File-based Conditions,  Up: Service selection

4.1.1 Regular Expressions
-------------------------

Request matching directives use POSIX extended regular expressions by
default.  If 'pound' was compiled with 'PCRE' or 'PCRE2' library,
"Perl-compatible regular expressions" can be used instead.  This can be
done either globally or individually for a given directive.

   To change regular expression type globally, use the following
directive:

     RegexType pcre

   It affects all conditions that appear after it in the configuration
file, until next 'RegexType' directive or end of file, whichever occurs
first.  To change back to POSIX regular expressions, use 'posix'
argument:

     RegexType posix

   Argument to the 'RegexType' directive is case-insensitive.

   Regular expression type can also be selected individually for a
directive, using '-posix' or '-pcre' flags.  For example:

     Host -pcre -icase "(?<!www\\.)example.org"


File: pound.info,  Node: File-based Conditions,  Next: ACL,  Prev: Regular Expressions,  Up: Service selection

4.1.2 File-based Conditions
---------------------------

Most conditional directives take '-file' and '-filewatch' options.  When
specified either option, the argument immediately following it is
treated as the name of a file from which to read the list of regular
expression patterns or other conditional parameters, depending on the
directive.  The file is read at startup and cached in memory, so that
applying the conditional does not result in disk accesses.

   If the '-file' option is used, the file is read at startup and its
contents is remembered for the lifetime of the program.  It is an error
if the file does not exist.  Any errors in the file are treated as
configuration file errors and cause immediate program termination.

   In the contrast, if the '-filewatch' option is used, the file is read
at startup and a file system monitor is set up to catch its
modifications.  Once a change to the file is detected, it will be
reloaded without interrupting the operation of the server.
Consequently, when the '-filewatch' option is used, it is OK if the file
does not exist at startup.  Furthermore, any errors in the file contents
are reported, but don't cause program termination.

   The support for that option depends on the operating system.  On
GNU/Linux systems, 'pound' uses 'inotify' kernel API (1).  On BSD
systems (FreeBSD, OpenBSD, NetBSD, Darwin), it uses 'kqueue'(2).  To
check which API your 'pound' binary is compiled with, examine the output
of 'pound -V'.

   Both 'inotify' and 'kqueue' allow 'pound' to react immediately on
file system changes.  On systems that don't support either API, 'pound'
falls back to periodic checking of file modification time ("mtime").  In
that case, the reload is initiated if 'mtime' changes.  The interval
between two successive checks is defined by the 'WatcherTTL' statement
(*note WatcherTTL: Timeouts.) and defaults to 60 seconds.

   Following is a list of conditional statements that implement file
monitoring support: 'BasicAuth', 'Header', 'Host', 'Path', 'Query',
'QueryParam', 'StringMatch', 'URL'.

   *Note request matching directives::, for a detailed discussion of
these.

   ---------- Footnotes ----------

   (1) *Note monitoring file system events: (inotify(7))inotify.

   (2) *note kernel event notification mechanism: (kqueue(2))kqueue.


File: pound.info,  Node: ACL,  Next: Detached Conditions,  Prev: File-based Conditions,  Up: Service selection

4.1.3 ACL
---------

Access control lists, or "ACLs", are special conditional statements that
evaluate to true for requests originating from one of the predefined IP
addresses.  Access control lists are defined using the 'ACL' section
statement, which has three forms: anonymous, file reference, and ACL
reference.  In all three forms, the 'ACL' statement accepts optional
argument '-forwarded', which indicates that the remote IP should be
determined from the 'X-Forwarded-From' IP address (*note %a::), instead
of using the actual originator IP.

   In "anonymous" form, the 'ACL' is a section statement: the keyword is
followed by a newline and a list of CIDRs, terminated with 'End' on a
separate line.  Each line in the list defines a single CIDR enclosed in
double quotes.  A "CIDR" consists of a "network address" (IPv4 or IPv6),
optionally followed by slash and "network mask length", a decimal number
in the range [0,32] for IPv4 and [0,64] for IPv6.  For example:

     ACL
         "127.0.0.1/8"
         "192.0.2.0/25"
     End

   For convenience, 'Include' statements (*note File inclusion::) can
also be used between 'ACL' and 'End'.

   In "file reference" form, the ACL syntax is:

     ACL -file "NAME"

or

     ACL -filewatch "NAME"

   Here, NAME is the name of a disk file with the ACL definition.  Its
syntax is similar to the contents of anonymous ACL definition, except
that CIDRs need not be quoted, and 'Include' statements are not allowed.
If the file name is relative, it is looked up in the *note include
directory::.

   If the '-file' keyword is used, the file is read at startup and its
contents is remembered for the lifetime of the program.  It is an error
if the file does not exist.  Any errors in the file are treated as
configuration file errors and cause immediate program termination.

   If the '-filewatch' keyword is used, the file is read at startup and
is then being monitored for changes during the runtime.  *Note
File-based Conditions::, for details.

   The third syntax form for 'ACL' statements is "ACL reference".  As
its name implies, the ACL in this form refers to another "named ACL",
defined elsewhere in the configuration files.  Syntactically, it is

     ACL "NAME"

where NAME is the name of the ACL to refer to.  This syntax makes it
possible to use a single ACL in multiple places of the configuration
file.

   Named access control lists are defined at the top level of a
configuration file.  Syntactically, the definition is similar to
anonymous or file reference forms of ACLs as discussed above, except
that the keyword 'ACL' is followed on the same line by the name to be
assigned to that ACL, in double quotes.  Thus the following are valid
named ACL declarations:

     ACL "secure" -file "aclfile"

     ACL "secure" -filewatch "aclfile"

     ACL "secure"
         "127.0.0.1/8"
         "192.0.2.0/25"
     End

   All three examples define a named ACL 'secure'.  The former two read
its contents from the disk file 'aclfile'.  The latter one provides its
definition in the form of a section.  This ACL can then be used in any
'Service' appearing after its definition by using the following
construct:

     ACL "secure"

   Consider for example the following service declaration:

     Service
         ACL "secure"
         Path -beg "/stat"
         Backend
             ...
         End
     End

   This service will handle requests whose URL starts with '/stat', if
they came from one of the IP addresses mentioned in the access control
list with the name 'secure'.  Effectively, this means that the access to
that URL is limited to these IP addresses.


File: pound.info,  Node: Detached Conditions,  Prev: ACL,  Up: Service selection

4.1.4 Detached Conditions
-------------------------

If a conditional statement is used in multiple places throughout the
configuration, it could be wise to rewrite it as a "detached condition".
Detached condition is an abstract conditional statement, not connected
with any service or listener.  It is assigned a unique name that serves
as its identifier.  Syntactivally, such conditonal is defined using
'Condition' section in global scope of the configuration file:

     Condition "NAME"
       ...
     End

Here, the ellipsis represents any number of conditional statements
described above.

   Once defined, detached conditions can be "evaluated" in any number of
'Service' or 'Rewrite' sections, using the following construct:

     Eval "NAME"

   Evaluating a detached condition means applying its contents to the
incoming request.  In this regard, it can be seen as an equivalent to
including contents of the 'Condition' statement in place.  There are two
major differences, though.  First, any parenthesized groups in regular
expressions (*note parenthesized subexpression::) are visible only
within condition itself.  In other words, they cannot be referred to
from outside the 'Condition' block.  Secondly, and most importantly, no
matter how often used in the configuration, each detached condition is
evaluated only once.  All subsequent 'Eval' statements just return the
result of first evaluation.  This way, the use of detached conditions
can speed up request processing (and reduce the CPU load) for
conditionals that require a lot of calculations, such as long ACLs or
complex Lua functions (*note Lua::).

   Consider the following configuration snippet (irrelevant statements
being omitted):

     Condition "secure"
         ACL -file "secure.acl"
     End

     ListenHTTP
         ...
         Service "a"
             Host -re ".*\\.example\\.com"
             Eval "bigacl"
             Backend
                 Address 192.0.2.129
             End
         End
         Service "b"
             Host "example.com"
             Backend
                 Address 192.0.2.5
             End
         End
         Service "c"
             Host "bar.example.com"
             Eval "bigacl"
             Backend
                 Address 192.0.2.2
             End
         End
     End

   If a request comes for host 'bar.example.com' from an IP listed in
file 'secure.acl', it will be matched against conditionals in services
'a' and 'b' before selecting service 'c'.  When processing 'a', the
'Eval' statement will scan the ACL, find that it matches the originator
IP and cache that value.  When the same statement is encountered in
service 'c', no actual ACL processing will take place, instead 'pound'
will reuse the result cached earlier.  If 'secure.acl' contains a long
list of IP addresses, this can save a lot of time.


File: pound.info,  Node: Request modifications,  Next: Conditional branches,  Prev: Service selection,  Up: Simple Proxy

4.2 Request modifications
=========================

A service can modify requests before forwarding them to backends.
Several statements are provided for that purpose:

SetHeader
     Set a HTTP header.

DeleteHeader
     Delete a HTTP header.

SetURL
     Rewrite the request URL.

SetPath
     Rewrite the path part of the URL.

SetQuery
     Rewrite the query part of the URL.

DeleteQuery
     Delete the query part of the URL.

SetQueryParam
     Set or delete a single query parameter.

   For example, the following service declaration will add the header
'X-Resent-By: pound' to each request:

     Service
         SetHeader "X-Resent-By: pound"
         Backend
            ...
         End
     End

   Arguments to request modification statements are expanded before
actual use.  During expansion, references to "parenthesized
subexpressions" in conditionals are replaced with their actual values.
"Parenthesized subexpression" is a part of a regular expression enclosed
in parentheses.  It can be referred to in string arguments as '$N',
where N is its ordinal number.  Numbers start at one, '$0' referring to
the entire string that matched.

   The process of expanding parenthesized subexpressions is called
"backreference expansion".

   For example, the following condition:

     Header "Content-Type: ([^/]+)/(.+)$"

has two subexpressions: '$1' and '$2'.  The following fragment uses
these values to add two query parameters to the URL:

     SetQueryParam "type" "$1"
     SetQueryParam "subtype" "$2"

   As a more practical example, the following service rewrites the path
to JPEG and GIF images:

     Service
         Path "/([^/]+\\.(jpg|gif))$"
         SetPath "/images/$1"
         ...
     End

   When several conditions are used, these forms refer to the last
matched one.  Subexpressions in prior statements can be referred to
using the '$I(J)' construct.  Here, J is either the "tag" of the
expression to refer to (if the statement was tagged, *note tag::), or
the 0-based number of the statement, counted from the last one upwards.
For example, consider the following statements:

     Host -tag "host" -re "(www\\.)?(.+)"
     Header -tag "type" -icase "^Content-Type:[[:space:]]*(([^/]+)/([^;]+)).*"
     Path -tag "dir" "^/static(/.*)?"

   If the incoming request was 'GET /static/index.html' with the two
headers

     Host: example.org
     Content-Type: text/html

then, the backreferences and the corresponding strings will be:

     $1 => /index.html
     $1(dir) => /index.html
     $1(1) => text/html
     $2(1) => text
     $3(1) => html
     $1(type) => text/html
     $2(type) => text
     $3(type) => html
     $1(2) => www.
     $2(2) => example.org
     $1(host) => www.
     $2(host) => example.org

   String arguments to 'Set' statements can also contain "request
accessors" - special constructs that are expanded to particular values
from the request.  Syntactically, a request accessor is '%[NAME]', where
NAME denotes the request part to access.  For example, '%[url]' expands
to entire URL, '%[path]' to the path part of the URL, etc.

   Using request accessors, the above example of path modification can
be rewritten as:

     Path "\\.(jpg|gif)$"
     SetPath "/images%[path]"

   *Note Request Accessors::, for a detailed discussions of available
accessors.


File: pound.info,  Node: Conditional branches,  Next: Modifying responses,  Prev: Request modifications,  Up: Simple Proxy

4.3 Conditional branches
========================

Conditional request modifications can be organized in logical branches,
each branch being applied only if the request matches certain condition.
The 'Rewrite' section encloses a set of conditional statements followed
by one or more request modification statements, which will be applied if
the former match the request.  Optional 'Else' sub-section, which in
turn contains conditional and modification statements, will be tried if
those rules don't match.  Any number of 'Else' sub-sections is allowed,
each one being tried if the previous ones don't match.

   The example below illustrates this concept.  This configuration
snippet sets different paths depending on the file type and URL used:

     Service
         Rewrite
             Header "Content-Type:[[:space:]]+image/.*"
             SetPath "/images%[path]"
         Else
             Match AND
                 Host "example.org"
                 Path "\\.[^.]+$"
             End
             SetPath "/static%[path]"
         Else
             Path "\\.[^.]+$"
             SetPath "/assets%[path]"
         End
         ...
     End


File: pound.info,  Node: Modifying responses,  Next: Authentication,  Prev: Conditional branches,  Up: Simple Proxy

4.4 Modifying responses
=======================

The 'rewrite' statement can also be used to modify responses received
from backends before passing them back to the querying party.  To
indicate this intent, the 'Rewrite' statement must be followed by the
'response' keyword:

     Rewrite response
         SetHeader "X-Been-There: pound"
     End

   When modifying responses, only two request modification statements
are allowed: 'SetHeader' and 'DeleteHeader'.  The list of conditionals
is limited as well: 'Header' and 'StringMatch', plus 'Match' and 'Not'
directives.  Notice that these conditionals operate on the response, and
not on the request, as in previous chapters.  For example:

     Rewrite response
         Header "Content-Type:[[:space:]]+text/(.*)"
         SetHeader "X-Text-Type: $1"
     End

   This will insert an additional 'X-Text-Type' header into the
response.  It will contain the subtype value from the 'Content-Type'
header of the original response.


File: pound.info,  Node: Authentication,  Next: Rate-limiting,  Prev: Modifying responses,  Up: Simple Proxy

4.5 Authentication
==================

Along with access control lists, introduced above (*note ACL::),
authentication provides another way to limit access to certain services.
'Pound' supports "basic authentication", as defined in RFC 7617.

   This authentication method relies on the presence of the
'Authorization' header in the HTTP request.  If the header is present,
its value specifies the 'Basic' authorization method and contains
credentials (username and password) that match one of the users from the
server user database, the request is accepted.  Otherwise a 401
('Authentication Required') or 407 ('Proxy Authentication Required')
response is returned with the 'WWW-Authenticate' header requesting basic
authentication.

   The 'BasicAuth' conditional statement verifies if the 'Authorization'
header is present and provides correct credentials.  The statement
matches the request if so.

   The 'BasicAuth' statement takes a single argument, specifying the
name of a file containing "user database".  This is a plain-text file
created with 'htpasswd' or similar utility, i.e.  each non-empty line of
it must contain username and password hash separated by a colon.
Password hash can be one of:

   * Password in plain text.
   * Hash created by the system 'crypt'(3) function.
   * Password hashed using SHA1 algorithm and encoded in BASE64.  This
     hash must be prefixed by '{SHA}'.
   * 'Apache'-style 'APR1' hash.

   Password file is read at startup, after which its contents is stored
in memory.  'Pound' will re-read it if it notices that the file has
changed, so you need not restart the daemon if you do any changes to the
file.

   Thus, if you put the 'BasicAuth' statement in each service that must
be accessible to authorized users only, that would do the first and
principal part of the basic authentication scheme: access control.
There remains second part: returning properly formatted 401 response if
the request did not pass authorization.  That can be done using a
combination of the 'Error' internal backend (*note Error responses::)
and response modification techniques described in the previous section.

   However, instead of using 'BasicAuth' in each service requiring
limited access and placing a service generating the 401 response in the
end, it is simpler and less error-prone to use the following approach:

   Create a service with the following content:

     Service
         Not BasicAuth "pound/htpasswd"
         Rewrite response
             SetHeader "WWW-Authenticate: Basic realm=\"Restricted access\""
         End
         Error 401
     End

   Replace the file name ('pound/htpasswd') and realm name ('Restricted
access') with the actual values.

   Make sure that all services that need to be protected by basic
authentication are declared after that service.  This way, any request
that does not convey an 'Authentication' header with credentials
matching an entry from your password file will match this service, and
will be replied to with a properly formatted 401 response, which will
prompt the remote user to authenticate themselves.  On the other hand,
authorized requests will not match this service and will eventually be
handled by one of the services declared after it.


File: pound.info,  Node: Rate-limiting,  Next: Redirects,  Prev: Authentication,  Up: Simple Proxy

4.6 Rate-limiting
=================

Rate-limiting is a technique that controls the number of requests
processed by a service in a second.  'Pound' contains mechanism to
implement rate-limiting using "token bucket filter" algorithm.

   The token bucket filter decides whether a request can be accepted
based on the presence of abstract entities called "tokens" in a
container called "bucket".  Each token represents an ability to process
one incoming request.  The algorithm works as follows:

   * Tokens are added to the bucket at a constant rate of R tokens per
     second.
   * A bucket can host at most M tokens.  Any tokens arriving when the
     bucket is full are discarded.
   * If a request arrives when the bucket holds some tokens, one token
     is removed and the request is accepted.
   * If the bucket is empty, the request is not accepted.

   This algorithm makes sure requests are accepted at a constant rate or
R requests per seconds with bursts of up to M requests.  Such bursts
occur when no requests arrive for M/R or more seconds.

   The special conditional statement 'TBF' provides an interface to this
algorithm.  The statement takes three arguments: KEY, a string
identifying the bucket, and the values of R and M.  It evaluates to
"true" if the algorithm accepts the request and to "false" otherwise.
Placing that conditional in a 'Service' section ensures that requests
will be processed at the configured rate.  For each such service
section, there is normally another one to be used for requests that
arrive faster than allowed.  The selection criteria for the two sections
differ only by the absence of 'TBF' conditional in the second section.
Consider the following example:

     Service "git"
        Host "example.org"
        Path -re "^/git/([^/]+).*"
        TBF "$1" 5 10
        Backend
            Address 192.0.2.10
            Port 80
        End
     End
     Service "block"
        Host "example.org"
        Path -re "^/git/([^/]+).*"
        Error 429
     End

   This configuration limits request rate to any path beginning with
'/git/' (presumably, a 'git' repository) to 5 requests per second with
bursts of up to 10 requests.  The bucket to use is identified by the
first directory component after the '/git/' prefix, so that rates are
computed for each repository individually.  Requests that conform to
that policy are routed to the backend at '192.0.2.10:80'.  This is
configured by the service section 'git'.

   The requests that arrive quicker than permitted by that service will
be served by service 'block', which will respond to them with HTTP
status 429 ('Too Many Requests').  *Note Error: Special Backends, for a
discussion of 'Error' backend.

   To compute rates for each connection individually, use the 'remoteip'
accessor (*note Request Accessors::).  In that case the corresponding
fragment from the example above becomes:

        Path -re "^/git/([^/]+).*"
        TBF "%[remoteip 0]-$1" 5 10

   If the rate limit should apply to several services, the recommended
course of action is to declare such "error" service first, using a
common subset of conditions for all services it is intended to cover and
a negation of 'TBF'.  E.g.:

     Service "rate-limit"
        Host "example.org"
        Path -re "^/git/([^/]+).*"
        Not TBF "$1" 5 10
        Error 429
     End

   This service section shall be followed by the services it protects.


File: pound.info,  Node: Redirects,  Next: Error responses,  Prev: Rate-limiting,  Up: Simple Proxy

4.7 Redirects
=============

Apart from regular backends introduced in previous sections, 'pound'
provides also several "special" or "internal" backends.  As their name
implies, such backends handle requests and generate responses
internally, without forwarding them to any external entities.

   One of such internal backends is 'Redirect'.  It generates responses
redirecting the client to another location.  The statement takes two
arguments: a three-digit HTTP status code to return, and the URL to
redirect to:

     Service
         Redirect 301 "https://www.gnu.org"
     End

   Allowed values for the status code are 301, 302, 303, 307 and 308.
This argument is optional: if omitted, 302 is used.

   If the URL argument has no path component (as in the example above),
then the path (and query, if present) components from the original
request will be appended to it.  For example, if the original URL were
'http://example.com/software', the service above would redirect it
'https://www.gnu.org/software'.

   Otherwise, if the path component is present in the URL argument (even
if it is a mere '/'), then the URL is used as is.  For example, the
following will drop any path and query components from the URL when
redirecting:

     Redirect 301 "https://www.gnu.org/"

   The URL argument is subject to backreference expansion and request
accessor interpretation (*note Request modifications::).  If any of
these are actually used, the above logic is disabled.

   String expansions make it possible to implement complex redirects.
For example, the following redirect swaps the first two path components
of the original URL:

     Service
         URL "^/([^/]+)/([^/]+)(/.*)?"
         Redirect "http://%[host]/$2/$1$3"
     End

   The following is a standard paradigm for redirecting requests from
HTTP to HTTPS:

     Service
         Redirect 301 "https://%[host]%[url]"
     End


File: pound.info,  Node: Error responses,  Prev: Redirects,  Up: Simple Proxy

4.8 Error responses
===================

Another type of internal backends is 'Error', a backend that generates
error responses.  It is useful, for instance, to provide a custom error
status and/or message when no service matches the request.  Normally,
for such cases 'pound' generates a standard 503 response ('Service
Unavailable') with the built-in error page.  You can customize this
behavior by using as the last service a 'Service' section with 'Error'
backend.  For example:

     Service
         Error 404 "pound/404.html"
     End

   The first argument specifies the HTTP status code to return.  *Note
Error backend::, for more info.

   The second argument is optional.  It supplies the name of a file with
the error page to return along with the response.  The name may be
absolute or relative.  In the latter case, the file will be looked up in
the "include directory", a special directory for storing pound-specific
files.  *Note include directory::.  The file will be read only once, at
program startup.  If you modify the file and want 'pound' to notice
changes, you will have to restart it.

   Unless the file begins with a newline or '<' character, its initial
portion up to first empty line (inclusive) supplies headers that will be
sent with the response.  The following defaults will be used, unless
already defined in the file:

     Content-Type: text/html
     Expires: now
     Pragma: no-cache
     Cache-control: no-cache,no-store

   If the second argument is not supplied, the error text is determined
by the 'ErrorFile CODE' statement in the enclosing listener (where CODE
is the HTTP code in question).  If it is not supplied, the built-in
default text is used.  *Note Error definitions::.


File: pound.info,  Node: HTTPS,  Next: Balancer,  Prev: Simple Proxy,  Up: Top

5 HTTPS
*******

In the previous chapter we have described basic proxying techniques
using plain HTTP listener as an example.  Now we will discuss how to use
HTTPS both for listeners and backends.

   To accept HTTPS requests you need to declare 'ListenHTTPS' listener.
It is similar to plain 'ListenHTTP' described above, except that it
requires a "certificate" to be declared.  For example:

     ListenHTTPS
         Address 0.0.0.0
         Port 443
         Cert "/etc/ssl/priv/example.pem"
         Disable TLSv1
         Ciphers "HIGH:@STRENGTH:!RSA"
     End

   The 'Cert' statement supplies the name of the certificate file in PEM
format.  The file must contain the certificate, intermediate
certificates (if necessary), and certificate private key, in that order.

   The 'Cert' argument can also specify a directory, in which case
'pound' will scan that directory, trying to read the certificate from
each regular file encountered.  It will report an error if unable to
load the file, so this directory should contain only certificate files.
The order in which certificate files are read is not specified.

   Multiple 'Cert' statements are allowed.  When trying to find the
matching certificate, 'pound' will stop at the first one whose 'CN'
matches the requested host name.  Thus, the ordering of 'Cert'
statements is important.  Normally they should be placed in
most-specific to least-specific order, with wildcard certificates
appearing after host-specific ones.

   'Cert' directives must precede all other SSL-specific directives.

   Another important directive is 'Disable'.  It disables the use of the
specified TLS protocol as well as all protocols older than it.  Usually
it is used to disable obsolete protocols.  For example, the 'Disable'
statement in the example above disables 'TLSv1', 'SSLv3', and 'SSLv2'.

   To further tune the strength of your encryption use the 'Ciphers'
directive.  Its argument is a colon-delimited list of OpenSSL ciphers,
as described in *Note (ciphers(1))ciphers::.  The cipher selection shown
in the example above provides for excellent encryption strength.

* Menu:

* ACME::
* Redirect HTTP to HTTPS::
* HTTPS backends::


File: pound.info,  Node: ACME,  Next: Redirect HTTP to HTTPS,  Up: HTTPS

5.1 ACME
========

Automatic Certificate Management Environment ("ACME"), is a protocol for
automated deployment of HTTPS certificates.  It is perhaps the most
often used method for obtaining SSL certificates nowadays.  In order to
issue certificate for a domain or domains, the protocol verifies that
the web server that is requesting a certificate actually owns these
domains.  This process is based on various "challenge types".

   'Pound' supports HTTP-01(1) challenge type.  When issuing a
certificate using this challenge type, the ACME client (a program
responsible for periodic certificate re-issuing) obtains from the
authority a challenge file, and stores it in a predefined "challenge
directory".  The authority will then request this file from the
webserver using a predefined URL. It is supposed that the server will
serve it from the file that has been just written by the agent.  If the
server returns the file, its claim to own the domain is proved and the
certificate is issued.

   Configuring 'pound' to reply to challenge requests is as simple as
putting an 'ACME' statement to the 'ListenHTTP' section of its
configuration file.  The statement takes a single argument - name of the
challenge directory:

     ListenHTTP
         Address 0.0.0.0
         Port 80
         ACME "/var/lib/pound/.well-known/acme-challenge"
     End

   Needless to say, your ACME agent and 'pound' must agree on this
directory location.  Configuration of various ACME agents is beyond the
scope of this document.  Please refer to the documentation of your agent
for further details.

   ---------- Footnotes ----------

   (1) <https://letsencrypt.org/docs/challenge-types/#http-01-challenge>


File: pound.info,  Node: Redirect HTTP to HTTPS,  Next: HTTPS backends,  Prev: ACME,  Up: HTTPS

5.2 Redirect HTTP to HTTPS
==========================

Nowadays it is common to redirect all plain HTTP requests to HTTPS on
the same URL. The method of doing so was described in *note HTTP to
HTTPS: Redirects.  As an example, this section shows a working HTTPS
configuration with such redirect.

     ListenHTTP
         Address 0.0.0.0
         Port 80
         Service
             Redirect 301 "https://%[host]%[url]"
         End
     End

     ListenHTTPS
         Address 0.0.0.0
         Port 443
         Cert "/etc/ssl/priv/example.pem"
         Disable TLSv1
         Service
             Backend
                 Address 127.0.0.1
                 Port 8080
             End
         End
     End


File: pound.info,  Node: HTTPS backends,  Prev: Redirect HTTP to HTTPS,  Up: HTTPS

5.3 HTTPS backends
==================

Backends can use HTTPS as well.  To inform 'pound' that communication
with the backend goes over an encrypted channel, use the 'HTTPS'
keyword.  The typical usage is:

     Backend
         Address 192.0.2.1
         Port 443
         HTTPS
     End

   Notice, that unlike other statements, 'HTTPS' is used without
arguments.

   Additional directives are available for fine-tuning the connection.
If used, they must appear after the 'HTTPS' directive,

   The 'Cert' directive specify the client certificate to use when
connecting.  Use it if the backend requires client authentication.

   The 'Disable' and 'Ciphers' directives are similar to those described
when discussing 'ListenHTTPS': the former disables the given TLS
protocol and all protocols prior to it, and the latter configures the
list of OpenSSL ciphers which the client wishes to use.  The actual
cipher to use will be selected from this list during negotiation with
the backend.

   The example below illustrates the use of these directives:

     Backend
         Address 192.0.2.1
         Port 443
         HTTPS
         Disable TLSv1_1
         Cert "/etc/pound/crt/b1.pem"
         Ciphers "HIGH:!RSA"
     End


File: pound.info,  Node: Balancer,  Next: Worker model,  Prev: HTTPS,  Up: Top

6 Request balancing
*******************

When several backends are defined in a service, incoming requests will
be distributed among them.  This process is called "balancing".  By
default, requests are distributed equally.  This can be changed by
assigning them a "priority" - a positive integer which assigns a
relative weight of the given backend in the distribution algorithm.  The
greater the priority is, the more requests this backend gets from the
total flow.

   The distribution algorithm is defined by "balancing strategy".  As of
version 4.19, 'pound' supports two strategies: "weighted random
balancing" and "interleaved weighted round robin balancing".

"Weighted Random Balancing"

     This is the default strategy.  The backend to use for each request
     is determined at random, taking into account backend priorities, so
     that backends with numerically greater priorities have
     proportionally greater chances of being selected than the ones with
     lesser priorities.

"Interleaved Weighted Round Robin Balancing"

     This strategy cycles over all active backends, considering each one
     in its turn.  An integer ordinal number is assigned to each round,
     which is incremented (modulo number of backends) each time a new
     round is started.  A backend is assigned a request only if its
     priority is greater than the round number.

     This strategy offers several advantages compared with the previous
     one.  First, it results in a more even distribution of the
     requests.  Secondly, the resulting distribution is predictable.

   Overall, the share of requests a given backend receives can be
estimated as:

     P_{i} / S(P)

where P_{i} is the priority of the backend with index i, and S(P) is the
sum of all priorities.

   Weighted random balancing is used by default.  Each backend gets the
default priority 5, unless another value is expressly assigned using the
'Priority' statement, e.g.:

     Service
         Backend
             Address 192.168.0.1
             Port 80
             Priority 1
         End
         Backend
             Address 192.168.0.2
             Port 80
             Priority 9
         End
     End

   In this example, backend '192.168.0.2' will receive roughly 9 times
more requests than backend '192.168.0.1'.

   The balancing strategy to use is defined by the 'Balancer' keyword,
which can appear either in the global scope or within a 'Service'
section.  Its argument can be one of:

'random'
     Use weighted random balancing (default).

'iwrr'
     Use interleaved weighted round robin balancing.

   The 'Balancer' statement appearing in the global scope defines
balancing strategy for all services that don't have 'Balancer' statement
on their own.

* Menu:

* Sessions::
* Balancer groups::
* Dynamic backends::


File: pound.info,  Node: Sessions,  Next: Balancer groups,  Up: Balancer

6.1 Sessions
============

Some web applications attempt to introduce state persistence into the
stateless HTTP protocol, by defining "sessions" using various
mechanisms, such as specially defined headers, cookies, etc.  For such
applications it is critical that all requests that belong to a single
"session" be directed to the same server, i.e.  backend.  Clearly, this
disrupts the balancer logic, and requires that the proxy be able to
understand the backend's notion of session.

   'Pound' is able to detect and track sessions identified by client
address, Basic authentication (user id/password), URL parameter, cookie,
HTTP parameter, and HTTP header value.

   Session tracking is enabled on a per-service basis by a 'Session'
section.  The section must contain at least the 'Type' directive, which
specifies what type of session tracking to use, and the 'TTL' directive,
supplying session idle timeout in seconds.

   Session types are case-insensitive.  They are summarized in the table
below:

'IP'
     The 'IP' session tracking type instructs 'pound' to forward all
     requests from the same client IP address to the same backend
     server:

          Session
              Type IP
              TTL  300
          End

'Basic'
     Using this session tracking type, 'pound' parses the
     'Authentication' header of each request.  If the header is present,
     and specifies the 'Basic' authentication type, user ID is extracted
     from it.  Requests with the same user ID are forwarded to the same
     backend server.

          Session
              Type Basic
              TTL  300
          End

'URL'
     This tracking scheme uses the value of URL query parameter to
     define a session.  The parameter name is supplied using the 'ID'
     directive:

          Session
              Type URL
              TTL  300
              ID   "sess"
          End

     In this example, sessions are identified by the 'sess' parameter,
     The request URL might look like 'http://example.org?sess=123'.

'Cookie'
     The 'Cookie' tracking type use a certain cookie to identify
     sessions.  The cookie name is given by the 'ID' directive:

          Session
              Type Cookie
              TTL  300
              ID   "sess"
          End

'Header'
     Sessions are identified by the value of HTTP header whose name is
     given by the 'ID' directive, e.g.:

          Session
              Type Header
              ID   "X-Session"
              TTL  300
          End

'Parm'
     This is the least useful scheme.  Sessions are identified by HTTP
     parameter - a string that appears after a semicolon in the URL,
     such as 'bar' in 'http://foo.com;bar'

          Session
              Type PARM
              TTL  300
          End


File: pound.info,  Node: Balancer groups,  Next: Dynamic backends,  Prev: Sessions,  Up: Balancer

6.2 Balancer groups
===================

Backends within each service are grouped in "balancer groups".  Each
such group is assigned a unique integer "priority", which defines the
order in which groups are tried.  When selecting a backend, a group with
the numerically smallest priority is tried first and a suitable backend
is looked up among backends defined in that group, using one of the
balancing strategies discussed above.  If no backend can be selected
(e.g.  all backends are unavailable), next group is tried.  The process
continues until either a backend is chosen or the list of balancer
groups is exhausted.

   By default, backends declared using the 'Backend' keyword are
assigned to the balancer group 0.  These are backends used during normal
operation.  Backends declared using the 'Emergency' keyword (*note
Emergency::) are assigned to the balancer group 65535.  These backends
form a pool of "high availability" backends, which will be used if all
normal backends fail.

   More backend groups can be added using dynamic backends, discussed in
the next section.


File: pound.info,  Node: Dynamic backends,  Prev: Balancer groups,  Up: Balancer

6.3 Dynamic backends
====================

Normally, when a backend is declared in configuration file, the value
supplied with its 'Address' statement is resolved at once and the
resulting IP is associated with the backend.  Such backends are
"static".  You can also instruct 'pound' to resolve the hostname and
create as many backends as are the IP addresses it resolves to.  Such
backends are called "dynamic".(1)  When a dynamic backend is requested,
the 'Backend' statement defines a "matrix" which will be used as a
template to generate actual backends from the data in DNS. The TTL value
of the DNS record (or records) defines minimum time to live of the
generated backends.  When it expires, DNS will be queried again and
backends recreated according to the changes in its responses(2).

   In the simplest case, a dynamic backend can be created using 'A' or
'AAAA' DNS records.  If several records correspond to the hostname
defined in the 'Address' statement, 'pound' can either create a single
backend for each of them, or select one of them in round-robin fashion
and use it to create a backend.  Rest of backend parameters (port value,
priority, etc.)  will be taken from its matrix declaration.

   A more advanced way to create dynamic backends is using 'SRV'
records.  Each 'SRV' record has four associated parameters: priority,
weight, target and port.  The "priority" value defines the 'pound'
balancer group where to put generated backends.  "Weight" is assigned as
the priority for each generated backend(3).  Finally, "target" is used
as hostname to obtain IP addresses for the backends.  For example,
suppose the following DNS records are defined:

     $ORIGIN _tcp.example.org.
     ; _srv  TTL     SRV     prio    weight  port target.
     _proxy  60      SRV     10      40      8081 be0.example.org.
     _proxy  60      SRV     10      70      8082 be1.example.org.
     _proxy  60      SRV     20      10      8081 ha1.example.org.
     _proxy  60      SRV     20      10      8081 ha2.example.org.

   Assuming each of the target hostnames resolves to one IP address,
these records will produce two balancer groups of two backends each, and
will be roughly equivalent to the following statements:

     Backend
             Address "be0.example.org"
             Port 8081
             Priority 40
     End
     Backend
             Address "be1.example.org"
             Port 8082
             Priority 70
     End

     Emergency
             Address "ha1.example.org"
             Port 8081
             Priority 10
     End
     Emergency
             Address "ha2.example.org"
             Port 8081
             Priority 10
     End

   _Notice_, that an SRV record can have a weight of 0.  This will
translate to 'pound' backend priority 0, which is normally not allowed
(*note Balancer::).  According to RFC 2782, this is the preferred way of
defining weights where "there isn't any server selection to do", whereas
"[i]n the presence of records containing weights greater than 0, records
with weight 0 should have a very small chance of being selected".
'Pound' handles this as follows: if all 'SRV' records have zero weight,
priority of the resulting backends is set to 1.  This makes sure the
backend selection algorithm works and gives each backend equal chance of
being selected.  This translation does not take place, however, if at
least one of 'SRV' records has a weight greater than 0.  Another way to
handle such records is using the 'IgnoreSRVWeight' configuration
statement, which is discussed below.

   To declare backend as dynamic, use a symbolic host name in its
'Address' statement and add the 'Resolve' statement with one of the
following values:

 -- Dynamic Resolve: first
     Resolve the symbolic host name and use first IP from the DNS
     response as the address of the created dynamic backend.  Thus, this
     type will produce at most one dynamic backend.

 -- Dynamic Resolve: all
     Resolve the symbolic host name and create one backend for each
     address from the DNS response.  This enables load balancing between
     created backends.  Each backend will be assigned the same priority.

 -- Dynamic Resolve: srv
     Obtain 'SRV' records for the host name and use them to generate
     dynamic backends.  Each record produces new dynamic backend of
     'Resolve all' type, which creates regular backends as described
     above.  The weight field of the 'SRV' record is mapped to the
     priority field of each generated backend.  The priority field
     determines the balancer group where the backend will be hosted.

   When resolving hostnames, both IPv4 and IPv6 addresses are looked
for.  You can select the specific address family using the 'Family'
statement.  Its allowed values are:

'any'
     Use all address families available.  This is the default.

'inet'
     Use only IPv4 addresses ('A' DNS records).

'inet6'
     Use only IPv6 addresses ('AAAA' DNS records).

   For example:

     Backend
             Address "_proxy._tcp.example.org"
             Resolve srv
             Family any
     End

   Notice, that you need not supply 'Port' statement for dynamic
backends of 'srv' resolve type.  Normally, you don't need to supply
'Priority', either.  However, you may do so, if you wish to override the
weight settings from 'SRV' records.  In that case, inform 'pound' about
your decision using the following statement in 'Backend' section:

     IgnoreSRVWeight true

   There are several possible scenarios when this may be needed.  One of
them is when all 'SRV' records have weight of 0 (see above) and your
configuration defines one or more regular backends in the same balancer
group as backends generated by those records.  In that case, the default
priority assigned by 'pound' to those generated backends (1) may prove
to be too low for adequate balancing.  Using 'IgnoreSRVWeight' allows
you to fix that.  For example:

     Service
             Backend
                     Address 192.0.2.15
                     Port 80
                     Priority 8
             End
             Backend
                     Address "_proxy._tcp.example.org"
                     Resolve srv
                     Family any
                     IgnoreSRVWeight true
                     Priority 5
             End
     End

   In this example, backends generated by 'SRV' records for domain
'_proxy._tcp.example.org' will be assigned priority 5, no matter what
the actual value of 'SRV' weight field.

   Dynamic backends will be updated periodically, when the TTL of the
corresponding DNS records expires.  If the hostname cannot be resolved
or a DNS failure occurs, next update will be scheduled in 600 seconds
after the failure.  This interval can be configured using the
'RetryInterval' statement in the 'Backend' section, or globally, in the
'Resolver' section (*note resolver::).

   ---------- Footnotes ----------

   (1) Support for dynamic backends is enabled at compile time and
requires the GNU adns library (http://www.gnu.org/software/adns).  If
unsure whether your 'pound' binary includes it, inspect the 'pound -V'
output.

   (2) If necessary, the TTL value can be changed using the
'OverrideTTL' configuration directive.  *Note OverrideTTL: Backend.

   (3) Notice, that the 'SRV' terminology differs from what 'pound'
uses.  What is called priority in 'SRV' defines the "weight" of the
backend group for 'pound', whereas what is called weight in 'SRV'
defines the "priority" of a backend within a group.  This confusion is
due to historical reasons, and it would be hard to avoid it without
breaking backward compatibility.


File: pound.info,  Node: Worker model,  Next: Lua,  Prev: Balancer,  Up: Top

7 Worker model
**************

Each incoming request is processed by a specific "worker", i.e.  a
thread in the running program.  Total number of running workers is
controlled by three configuration parameters.  'WorkerMinCount' defines
the minimum number of workers that should always be running (5, by
default).  Another parameter, 'WorkerMaxCount' sets the upper limit on
the number of running workers (it defaults to 128).

   At each given moment, a worker can be in one of two states: "idle" or
"active" (processing a request).  If an incoming request arrives when
all running workers are active, and total number of workers is less than
'WorkerMaxCount', a new thread is started and the new request is handed
to it.  If the number of active workers has already reached maximum, the
new request is added to the "request queue", where it will wait for a
worker to become available to process it.

   The third parameter, 'WorkerIdleTimeout', specifies maximum time a
thread is allowed to spend in the idle state.  If a worker remains idle
longer than that and total number of workers is greater than the
allotted minimum ('WorkerMinCount'), this idle worker is terminated.


File: pound.info,  Node: Lua,  Next: Logging,  Prev: Worker model,  Up: Top

8 Extending 'pound' functionality with Lua
******************************************

Lua (http://lua.org) is a lightweight extension language developed at
the Pontifical Catholic University of Rio de Janeiro.  Functions and
modules written in Lua can be used to implement new features in 'pound'
without the need to modify its sources and recompile it.(1)

   Lua source files can be loaded using two distinct modes: "per-thread"
and "global".  In per-thread mode, each Lua file is loaded into each
worker thread separately.  This is the default.  In global mode sources
are loaded only once and exist in one copy, available for use in all
threads.  No matter what mode is used, Lua sources are read and
interpreted only once, at program startup.

   The main advantage of per-thread mode is speed.  Each thread runs its
own copy of Lua interpreter and doesn't have to synchronize its actions
with other threads.  Its disadvantage is a bit higher memory usage.

   Sources loaded in global mode reside in one interpreter, common for
all threads.  Consequently, before calling a Lua function, the thread
must lock the interpreter for its use, and unlock it afterwards.  While
the interpreter is in use by a single thread, remaining threads must
wait for it to be released in order to use it.  This results in certain
performance penalty.

   Both modes can be used together.  No matter which mode is used, Lua
functions sharing the same mode can use a special global variable to
exchange data between them, if they are called in different stages of
request processing.  This way, for example, a Lua test can pass its
results to the Lua backend.

* Menu:

* LuaLoad::    Loading Lua sources.
* LuaMatch::   Lua conditionals.
* LuaModify::  Changing requests and responses in Lua.
* Stash::      Sharing data between Lua invocations.
* LuaBackend:: Lua backends.
* Lua API::

   ---------- Footnotes ----------

   (1) To check if the binary supports Lua, run 'pound -V' and examine
its output.


File: pound.info,  Node: LuaLoad,  Next: LuaMatch,  Up: Lua

8.1 Global Lua Configuration
============================

Lua sources are loaded from the global 'Lua' section, using two
statements: 'Load' and 'LoadGlobal'.  These take as argument the name of
a Lua source file to parse and load.  As usual, relative pathnames are
looked up in the *note include directory::.

   The 'Load' statement loads the file to per-thread Lua interpreters,
while 'LoadGlobal' loads it to the global one.  Example usage:

     Lua
         Load "auth-bearer.lua"
     End

   If the file ends with a 'return' statement, it is loaded as in Lua
'require'.  The return value is then available in Lua global variable
whose name is obtained from the filename using the following procedure:

  1. Remove the '.lua' suffix.

  2. Unless first character is a letter of latin alphabet or underscore,
     add underscore at the beginning.

  3. In the resulting string, replace each character other than letter,
     digit or underscore with an underscore.

   Thus, if the file 'auth-bearer.lua' ends with a 'return', the
returned value will be available in Lua as 'auth_bearer'.

   You can also supply variable name explicitly, as second argument,
e.g.:

     Lua
         Load "auth-bearer.lua" "bearer"
     End

   Of course, you can use as many 'Load' (or 'LoadGlobal') statements as
there are files you wish to load.

   This section can also be used to modify Lua search paths.  Two
statements are provided for this purpose: 'Path' modifies search path
for Lua source files ('package.path'), and 'CPath' modifies search path
for dynamic libraries ('package.cpath').  Both statements add their
argument at the beginning of the corresponding 'package' path.  For
example:

     Lua
         Path "/usr/share/pound/?.lua"
         Load "auth-bearer.lua" "bearer"
     End

   Notice that 'Path' statement has no effect on where 'Load' looks for
its argument (it always uses 'pound' include path to locate relative
file names).  Instead, it affects 'require' statements in loaded Lua
sources.


File: pound.info,  Node: LuaMatch,  Next: LuaModify,  Prev: LuaLoad,  Up: Lua

8.2 Lua conditionals
====================

Lua functions are most commonly used to implement new conditions, that
can be used to select the 'Service' section to use.  Such conditions are
applied using 'LuaMatch' statements in 'Service' sections.  The
'LuaMatch' statement takes at least one argument: the name of Lua
function to call.  It can be followed by any number of string values,
which will be passed to the function as its arguments.  Before being
passed to the function, these values undergo backreference expansion and
request accessor interpretation (*note Request modifications::).

   The first argument can be either an unqualified name, as 'mycond', or
a fully qualified one, as 'modname.mycond'.  Use the latter form to call
functions defined in modules.

   Information about HTTP request is provided to Lua functions via the
built-in variable 'http.req', described in *note Lua API::.

   To illustrate the concept, here's the definition of a Lua test that
returns 'true' if the value of a header named in its first argument
matches any of its remaining arguments, treated as anchored Lua
patterns:

     function isheader(name, ...)
        local args = { ... }
        for _, pat in ipairs(args) do
           if string.find(http.req.headers[name], "^"..pat.."$") then
              return true
           end
        end
        return false
     end

   Supposing that this function is defined in file 'isheader.lua', it
can be used as follows:

     Lua
         Load "isheader.lua"
     End
     ListenHTTP
         ...
         Service
             LuaMatch "host" "foo[.]bar" "www[.]fo+[.]bar"
             Backend
                 ...
             End
         End
     End

   As a more practical example, the function below implements "Bearer"
authorization scheme.

     local bearer = {}
     local jwt = require 'jwt'

     function bearer.ok(secret)
        -- Read in the Authorization header.
        local bh = http.req.headers['Authorization']
        if bh == nil then
           return false
        end

        -- Check if it starts with "Bearer".
        local n, k = bh:find('%s+')
        if n == nil or bh:sub(1,n-1):lower() ~= 'bearer' then
           return false
        end

        -- Extract the token and parse it.
        local j, err = jwt.parse(bh:sub(k+1))
        if err ~= nil then
           return false
        end

        -- Verify the token.
        if not j:verify(secret) then
           return false
        end

        -- Check expiration time.
        if j.payload.exp ~= nil then
           local exp = tonumber(j.payload.exp)
           if exp == nil then
              return false
           elseif os.time() < j.payload.exp then
              return false
           end
        end

        return true
     end

     return bearer

*Note jwt.lua::, for the implementation of the 'jwt' module.

   The following configuration fragment uses 'bearer.ok' function as a
condition, to reject requests without a valid bearer token:

     Service
         Not LuaMatch "bearer.ok" "secret"
         Rewrite response
             SetHeader "WWW-Authenticate: Bearer realm=\"Restricted access\""
         End
         Error 401
     End


File: pound.info,  Node: LuaModify,  Next: Stash,  Prev: LuaMatch,  Up: Lua

8.3 Changing requests and responses in Lua
==========================================

The 'LuaModify' configuration statement instructs 'pound' to invoke a
Lua function, ignoring its return value.  In other words, the function
is called for its side effects, whatever they are.

   Syntactically, the statement is similar to 'LuaMatch', discussed in
the previous section: the function name is supplied as its first
parameter and the arguments, if any, as its remaining parameters.  Only
string arguments are allowed.

   'LuaModify' can appear anyplace where other request modification
statements are allowed: i.e.  in 'ListenHTTP' (or 'ListenHTTPS'),
'Service', 'Match' and 'Rewrite' sections.

   Most often this statement is used to modify the incoming request
before sending it out to the backend, or the response before returning
it back to the client.  To do so, the function invoked by 'LuaMatch' can
use the 'http' Lua module, discussed in *note lua-http::, in particular
its fields 'http.req' and 'http.resp'.

* Menu:

* Cookie injection::


File: pound.info,  Node: Cookie injection,  Up: LuaModify

8.3.1 Cookie Injection
----------------------

Cookie injection is a special technique which ensures that requests from
a client are always forwarded to the same backend, even if the backend
server in question does not provide any mechanism for session tracking.
It works as follows.  Upon first connection, 'pound' adds to the backend
response a 'Set-Cookie' header with a unique cookie generated for this
purpose.  This ensures that further requests from that client will bear
this cookie.  Then, it will suffice to configure 'pound' to use that
cookie for session tracking (*note Sessions::), and all subsequent
requests from that client will go to the same backend.

   In this subsection we will show how to implement cookie injection in
Lua using 'LuaModify'.

   Let's start from the Lua code.  We need a function that, being
invoked with the name of cookie as its argument, will check if that
cookie is present in the request and if not, will create it by adding a
'Set-Cookie' header to the response from backend:

     function inject(name, ttl)

   Here, NAME supplies the name of the cookie to check for, and TTL
provides its time-to-live in seconds, which is used if the cookie needs
to be set.

   Functions for operating on cookies are supplied by the 'cookie.lua'
module, described in *note cookie.lua::.  To generate unique session
identifiers, we will use the lua-uuid
(https://luarocks.org/modules/luau-project/lua-uuid) module.

   The resulting Lua module can then be written as follows:

     local _M = {}

     local uuid = require('lua-uuid')
     local cookie = require('cookie')

     -- Unless cookie NAME is already set, create and initialize it
     -- to a unique session identifier.  TTL supplies Max-Age.
     function _M.inject(name, ttl)
        local cookie = cookie.get(name)
        if cookie == nil then
           cookie.set(name, tostring(uuid.new()), ttl)
        end
     end

     return _M

   Suppose this program is saved in file 'mksess.lua', located in
'pound' include path.  First, this program needs to be loaded to
'pound'.  This is done in the global 'Lua' section:

     Lua
         Load "mksess.lua"
     End

   Then, the 'Service' section which should implement cookie injection,
must be configured to track sessions by the value of a cookie, and the
'inject' function must be called on each backend response.  Suppose the
cookie used for session tracking is named 'poundsession'.  Then:

     Service
         Session
             Type Cookie
             TTL  300
             ID   "poundsession"
         End
         Rewrite response
             LuaModify "mksess.inject" "poundsession" "300"
         End
         ...
     End

Notice, that TTL argument to 'mksess.inject' matches that in the
'Session' section.


File: pound.info,  Node: Stash,  Next: LuaBackend,  Prev: LuaModify,  Up: Lua

8.4 Sharing data between Lua invocations
========================================

Sometimes it is necessary to share data between Lua functions used as
conditions and modifiers in 'pound' configuration file.  An obvious way
of doing so is using Lua global variables.  This approach, however,
poses one major problem: values stored in globals will persist not only
when processing a single HTTP request, but also between different HTTP
requests, and this can cause undesirable side effects.

   To avoid this, 'pound' provides a special built-in variable 'stash'.
Its value is a table whose contents persist only while a singe HTTP
request is being processed.  Applications can fill it with whatever
values they like.

   To illustrate its use let's change the 'bearer' module from *note
LuaMatch::, so it can be used to select the service to use based on JWT
claims.  First, the 'bearer.ok' function should store the parsed JWT
object in stash before returning.  Its last lines will then look like:

        stash.bearer = j
        return true
     end

   Then, we implement a new method, which checks if the hostname given
as its argument is listed in one of the JWT claims:

     function bearer.urlOK(host)
        return stash.bearer ~= nil and
               stash.bearer.payload['http://' .. host] == true
     end

   Now this method can be used as a conditional to select the service to
use as shown in the example below:

     Service "auth"
         Not LuaMatch "bearer.ok" "secret"
         Rewrite response
             SetHeader "WWW-Authenticate: Bearer realm=\"Restricted access\""
         End
         Error 401
     End

     Service "foo"
         LuaMatch "bearer.urlOK" "foo.com"
         Backend
             Address 127.0.0.1
             Port 8081
         End
     End

     Service "bar"
         LuaMatch "bearer.urlOK" "bar.com"
         ...
     End

   The service 'auth', same as in the previous example, verifies that
the request carries a valid bearer token and, if so, saves off the JWT
for further use.  Subsequent services make use of this saved value to
verify if the corresponding claim is true: the service 'foo' is selected
if the claim 'http://foo.com' is true, and so on.


File: pound.info,  Node: LuaBackend,  Next: Lua API,  Prev: Stash,  Up: Lua

8.5 Lua backends
================

Lua extensions can also be used to define new backends.  Similarly to
conditions, a function implementing a backend can have an arbitrary
number of arguments.  It is not supposed to return any values, though.
Instead, before returning, it should define the response to be returned
to the client.  It does so by initializing fields of the internal
variable 'http.resp':

'code'
     This field must be assigned the HTTP status code (an integer value
     in the range 100 to 599).  If it is not initialized after the
     backend function returns, 'pound' will respond with the default
     'internal server error' page.

'reason'
     This is a textual reason corresponding to the status code.  This
     value is optional.  If not initialized, 'pound' will use the
     default value for the returned status code, if it is one of the
     codes supported internally (*note Error definitions::).  Otherwise
     the reason field will remain empty.

'headers'
     A table of response HTTP headers.

'body'
     Response body as a string.

   Here is an example of Lua backend function.  The function below can
be used to return meaningful error status if the JWT authorization
implemented in previous sections fails.  It supposes that function
'bearer.ok', before returning on error, initializes 'stash' fields
'error' and 'error_description' to the error code and textual
description, correspondingly.

     function bearer.error_backend()
        local text = 'Bearer realm="Restricted access"'
        if stash.bearer.error ~= nil then
           text = text .. ', error="' .. stash.bearer.error .. '"'
           if stash.bearer.error_description ~= nil then
              text = text .. ', error_description="' .. stash.bearer.error_description .. '"'
           end
        end

        http.resp.headers['WWW-Authenticate'] = text

        http.resp.code = 401
     end

   To use this backend, we modify the 'auth' service as follows:

     Service "auth"
         Not LuaMatch "bearer.ok" "secret"
         LuaBackend "bearer.error_backend"
     End


File: pound.info,  Node: Lua API,  Prev: LuaBackend,  Up: Lua

8.6 Lua API
===========

The 'pound' module.
-------------------

 -- Method on pound: string dump (arg)
     Dumps the value of its argument in a string form, suitable for
     using in Lua chunks.

 -- field of pound: integer loadctx
     This variable is initialized when loading Lua source files to the
     ordinal number of the Lua "state" where the file is being loaded.
     For globally loaded sources (*note global lua loading::), this
     variable is set to 0.  For per-thread loading, it is set to a
     positive integer identifying the state.

 -- Method on pound: void log (int PRIO, string MESSAGE)
     Outputs MESSAGE to the logging channel PRIO.

   The following constants can be used for PRIO argument:

 -- Constant of pound: DEBUG
     Debug messages.

 -- Constant of pound: INFO
     Informative messages.

 -- Constant of pound: NOTICE
     Important notices.

 -- Constant of pound: WARNING
     Warning messages.

 -- Constant of pound: ERR
     Errors.

 -- Constant of pound: CRIT
     Critical errors.

 -- Constant of pound: ALERT
     Serious alerts.

 -- Constant of pound: EMERG
     Emergency messages

 -- Method on pound: integer tid ()
     Returns identifier of the current 'pound' thread.

 -- Method on pound: gcall (string FUNC, ...)
     Call function FUNC defined in a globally-loaded Lua module, passing
     it the remained arguments.  Return whatever values FUNC returns.

     This function makes it possible for a function in a per-thread
     module to invoke a function from global context.  Notice the
     following limitations:

       1. As for any function from globally-loaded module, the global
          Lua state will be locked until FUNC returns.

       2. Types of arguments that can be passed to FUNC and returned
          from it are limited to the following: 'nil', boolean, number,
          string, and table.  In the latter case, the same restriction
          applies to keys and values of the table.  Besides, tables
          cannot contain cyclic references.

       3. Calling this function from a globally-loaded module is also
          allowed.  It is equivalent to calling 'FUNC(...)'.

The 'http' module.
------------------

This built-in module contains variables and methods describing the HTTP
request being handled.

 -- Method on http: table req
     Returns a table describing the request.  This is a read-only table,
     whose fields and methods are described below.

 -- Field of req: string method
     HTTP method used in the request.

 -- Field of req: string line
     Request line, i.e.  part of the request between the method and HTTP
     version designator.

 -- Field of req: string url
     URL part of the request.

 -- Field of req: string path
     Pathname part of the request.

 -- Field of req: table version
     HTTP version of the request.  Used in string context, returns
     version as a string:

          tostring(http.req.version) => "1.1"

     Two variables are provided to access version parts:

      -- Field of version: integer major
          Major part or the version.

      -- Field of version: integer minor
          Minor part or the version.

 -- Field of req: table query
     Query part of the request.  Converted to string, returns the query
     in full:

          tostring(http.req.query) => "t=history&r1=10"

     Accessed as table, returns values of parameters used as keys:

          http.req.query['t'] => "history"
          http.req.query.r1 => "10"

 -- Field of req: table headers
     Returns headers of the request.  Converted to string, returns all
     headers as a (multiline) string, terminated with a newline.
     Indexed as a table, returns values of fields used as keys.

          tostring(http.req.headers) => "Host: example.net\nContent-Type:text/plain\n"
          http.req.headers['Host'] => "example.net"

   For functions invoked from 'LuaBackend' or Lua directives used in
'Rewrite response' context, the 'http' module provides methods for
examining and updating the response.

 -- Field of http: table resp
     A table describing the response.  It is a read-write table.
     Assigning to its fields modifies the response that will be sent out
     by 'pound' when the 'LuaBackend' function returns.

 -- Field of resp: integer code
     HTTP status code of the response.  An integer number in the range
     '[100,599]'.  The 'LuaBackend' function must set this field/

 -- Field of resp: string reason
     Textual reason describing the response.  Setting it is optional.
     If not set, and the 'resp.code' is set to one of the values
     supported by 'pound' (*note Error definitions::), the standard
     reason will be used instead.

 -- Field of resp: table headers
     Headers of the response.  When read, these behave similarly to
     request headers, described above (*note http.req.headers::).
     Setting this field to 'nil' removes all headers.  Setting it to a
     table, fills all headers from it.  Otherwise, each header can be
     set separately, as

          http.resp.headers['Host'] = "example.org"

 -- Field of resp: string body
     The request body.

The 'stash' table
-----------------

 -- Lua variable: table stash
     This global variable can be used to exchange data between Lua
     functions called within the same Lua "state", but invoked from
     different 'pound' handlers.  For example, a test invoked by
     'LuaMatch' directive can leave there some data for use by the
     backend ('LuaBackend').

     Upon receiving a new HTTP request, this table is guaranteed to be
     empty.  The values stored in it persist until the response is sent.

     Notice, that 'stash' is unique for each Lua state, so that it
     cannot be used to pass data from functions loaded globally to
     per-thread ones, and vice versa.  *Note gcall::, for a ways to
     interface between local and global contexts.


File: pound.info,  Node: Logging,  Next: Configuration,  Prev: Lua,  Up: Top

9 Logging
*********

'Pound' can send its diagnostic messages to standard error, syslog, or
to both.

   Upon startup, while the configuration file is being parsed, the
diagnostics goes to the standard error.  Once it switches to the
operation mode and starts serving requests, diagnostic output is
switched to syslog.  The syslog facility to use is configured via the
'LogFacility' configuration directive.  By default, 'daemon' is used.

   When running in foreground mode, the '-e' command line option
instructs 'pound' to use standard error for logging, thus overriding the
settings from the configuration file.

   Normally, 'pound' is not very loquacious in logging: only errors and
exceptional conditions are reported.  Messages concerning 'pound' itself
are reported to syslog facility 'err'.  Messages that describe
exceptional conditions detected when serving requests are reported to
facility 'notice'.  These latter have the following format:

     pound: (TID): CLIENT-IP: "REQUEST": MESSAGE
     or
     pound: (TID): eNNN: CLIENT-IP: "REQUEST": MESSAGE

where:

TID
     Thread identifier.

NNN
     Optional three-digit HTTP status code.

CLIENT-IP
     IP address of the client.

REQUEST
     HTTP request being served.

MESSAGE
     Message text.

   If the condition being reported concerns the backend, then the IP
address of the backend is included as well, e.g.(1):

     pound: (7fcb33924640): 192.0.20.3 => 10.0.0.1:8081:
             "POST /upload HTTP/1.1": error writing to backend

   The '=>' marker between IP addresses indicates flow direction: from
'pound' to backend.  If an error occurs while transferring response from
backend to client, it is indicated by '<=', as in:

     pound: (7fcb33924640): 192.0.20.3 <= 10.0.0.1:8081:
             "POST /upload HTTP/1.1": response read error

   Additionally, 'pound' can be instructed to log each processed
request.  These "access logs" are emitted for each processed request
_after a response was sent back to the client_, and go to the syslog
facility 'info'.

   Such additional logging is configured using two directives:
'LogLevel' and 'LogFormat'.  The 'LogLevel' directive can appear either
in listener scope, in which case it affects only this particular
listener, or in global scope, where it affects all listeners that don't
configure it on their own.  The value of this directive can be either an
integer number in range 0 through 5 (inclusive), or a quoted string.
Numeric value requests one of the "built-in log formats".  String value
refers either to a built-in format name, or to a user-defined format
name.

   The built-in formats are:

0
null
     No request logging at all.

1
regular
     For each request, its source address, request line and response
     status are logged.

2
extended
     In addition to the above, the selected service and backend are
     shown.

3
vhost_combined
     Detailed request logging using Apache-style "Combined" log format.

4
combined
     Same as above, but without virtual host information.

5
detailed
     Same as 'combined', with additional information about the selected
     service and backend.

   If the string argument to 'LogLevel' is not one of the above, it must
refer to the name of a "custom format", defined earlier using the
'LogFormat' statement.  This statement takes two string arguments: the
name to be assigned to the new format, and its definition.

   The "format definition" is a character string composed of ordinary
characters (not '%'), which are copied unchanged to the resulting log
message, and conversion specifications, each of which are replaced by a
corresponding piece of information about the request or reply.

   Conversion specifications are single characters prefixed with a
percent sign.  Depending on the specification, an optional "conversion
argument" in curly brackets may appear between '%' and conversion
character.

   The following conversion characters are defined:

 -- Format specifier: %%
     Replaced with the percent sign.

 -- Format specifier: %a
     Originator IP address of the request.  If the request contains
     'X-Forwarded-For' header and 'TrustedIP' ACL is defined, the value
     of the header is consulted to obtain the IP address.  The value
     must be a comma-delimited list of intermediate user-agent IP
     addresses.  To determine the actual user-agent IP, the list is
     traversed from right to left, until an IP is found that is not
     listed in 'TrustedIP' ACL.

     If 'X-Forwarded-For' is not present, or 'TrustedIP' is not defined,
     or the above algorithm does not return an IP address, '%a' expands
     to the actual remote IP address the request came from (same as
     '%h').

     The 'TrustedIP' ACL can be defined in global scope, or in
     'ListenHTTP' ('ListenHTTPS') section, or in 'Service' section.
     Most-specific ACL overrides least-specific ones, that is a
     'TrustedIP' defined in 'Service' will be used, if it is defined.
     If not, the one defined in listener will be used, etc.  The syntax
     of the 'TrustedIP' statement is the same as that of 'ACL', i.e.

          TrustedIP "NAME"

     refers to the named ACL NAME (which must be defined earlier, *note
     ACL::),

          TrustedIP
            "CIDR0"
            "CIDR1"
            ...
          End

     defines the list of trusted IPs in place, and

          TrustedIP -file "FILENAME"
          TrustedIP -filewatch "FILENAME"

     reads CIDR definitions from file FILENAME (*Note File-based
     Conditions::, for a discussion of the difference between '-file'
     and '-filewatch').

     If needed, the 'ForwardedHeader' statement may be used to declare
     the name of the header to use instead of 'X-Forwarded-For'.  As
     'TrustedIP', this statement can appear in global, listener, or in
     service scope.

 -- Format specifier: %A
     Local IP address of the listener.

 -- Format specifier: %B
     Size of response in bytes, excluding headers.

 -- Format specifier: %b
     Same as '%B', but in "CLF" format, i.e.  a dash is used when
     response size is zero.

 -- Format specifier: %D
     The time taken to serve the request, in microseconds.

 -- Format specifier: %h
     Client IP address of the request.

 -- Format specifier: %H
     The request protocol.

 -- Format specifier: %{HDR}i
     The contents of 'HDR:' header line in the request.  Changes made by
     header modification directives affect this.

 -- Format specifier: %{HDR}I
     Same as '%i', except that if no such header is present in the
     request, a dash is substituted.

 -- Format specifier: %l
     Single dash.  This specifier is reserved for future use.

 -- Format specifier: %{OBJ}L
     Location of the 'pound' object that is involved in handling the
     request.  Valid values for OBJ are: 'listener', 'service', and
     'backend'.

     The location gives position in the configuration file where the
     object was defined, and is formatted as

          NAME:LN1.COL1-LN2.COL2

     where NAME is the configuration file name, LN1 and COL1 are line
     and column where the object definition begins, LN2 and COL2 are
     line and column where it ends.  Line and column numbers start with
     1.

 -- Format specifier: %m
     The request method.

 -- Format specifier: %{OBJ}N
     Name of 'pound' object that is involved in handling the request.
     Valid values for OBJ are: 'listener', 'service', and 'backend'.

 -- Format specifier: %p
     Port number of the listener serving the request.

 -- Format specifier: %P
     Thread ID of the serving thread.

 -- Format specifier: %q
     The query string (prepended with a '?') if it exists, otherwise an
     empty string.

 -- Format specifier: %r
     First line of request.

 -- Format specifier: %s
     Response status code.

 -- Format specifier: %>s
     First line of the response.

 -- Format specifier: %t
     Time the request was received, in the format '[18/Sep/2011:19:18:28
     -0400]'.  The last number indicates the timezone offset from UTC.

 -- Format specifier: %{FORMAT}t
     Time the request was received, in the format specified by the
     argument (*note Time and Date Formats::).  If the format starts
     with 'begin:' (default) the time is taken at the beginning of the
     request processing.  If it starts with 'end:', it is the time after
     the response from the backend has been sent back to the requester.
     In addition to 'strftime' formats, the following specifications are
     recognized:

     sec
          Number of seconds since the Epoch.
     msec
          Number of milliseconds since the Epoch.
     usec
          Number of microseconds since the Epoch.
     msec_frac
          Millisecond fraction of the time.
     usec_frac
          Microsecond fraction of the time.

 -- Format specifier: %T
     The time taken to process the request, in seconds.

 -- Format specifier: %{UNIT}T
     The time taken to process the request, in a time unit given by
     UNIT.  Valid units are 'ms' for milliseconds, 'us' for
     microseconds, 's' for seconds, and 'f' for seconds with fractional
     part.  Using 's' gives the same result as '%T' without any format;
     using 'us' gives the same result as '%D'.

 -- Format specifier: %u
     Remote user if the request was authenticated.

 -- Format specifier: %U
     The URL path requested.  This is affected by request modification
     directives.

 -- Format specifier: %v
     Hostname used in the request (from the 'Host' header, without port
     number).

   The table below describes the built-in formats in terms of format
definitions:

0
null
          ""

1
regular
          "%a %r - %>s"

2
extended
          "%a %r - %>s (%{Host}i/%{service}N -> %{backend}N) %{f}T sec"

3
vhost_combined
          "%v:%p %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""

4
combined
          "%a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\""

5
detailed
     (Split in two lines for readability)
          "%v:%p %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-Agent}i\"
          (%{service}N -> %{backend}N) %{f}T sec"

   ---------- Footnotes ----------

   (1) These example messages are split in two lines for readability


File: pound.info,  Node: Configuration,  Next: poundctl,  Prev: Logging,  Up: Top

10 Configuration
****************

A configuration file provides 'pound' with the information necessary for
performing its tasks.  Some configuration file statements can be
overridden from the command line.

* Menu:

* Lexical structure::
* Syntax::
* String Expansions::
* Global directives::
* File inclusion::
* Logging configuration::
* Management interface::
* Timeouts::
* ListenHTTP::
* ListenHTTPS::
* Service::
* resolver::


File: pound.info,  Node: Lexical structure,  Next: Syntax,  Up: Configuration

10.1 Lexical structure
======================

Lexically, the file contains tokens of three types: keywords, values,
and separators.  Blanks, tabs, newlines and comments, collectively
called "white space" are ignored except as they serve to separate
tokens.  Some white space is required to separate otherwise adjacent
keywords and values.

   "Comments" may appear anywhere where white space may appear in the
configuration file.  A comment begins with a hash sign ('#') and
continues to the end of the line.

   A "keyword" is a sequence of ASCII letters, digits and underscores
that begins with an ASCII letter or underscore.  Keywords are always
case-insensitive.

   There are three kinds of "values": numeric values (or "numbers"),
boolean values, quoted strings, and IP addresses.

"Numbers"
     A "numeric value" is a sequence of decimal digits.

"Booleans"
     A "boolean" is one of the following: 'yes', 'true', 'on' or '1',
     meaning "true", and 'no', 'false', 'off', '0' meaning "false".

"Strings"
     A "quoted string" or "string", for short, is a sequence of
     characters enclosed in a pair of double quotes.  A backslash ('\')
     appearing within a string acts as an "escape character": if it is
     followed by a double-quote or another backslash, it forces the
     character that follows it to be treated as an ordinary one.  For
     example:

          "string with \" character"

     A backslash followed by any character other than '"' or '\' is
     removed and a warning to that effect is output.  For example, the
     following statement:

          user "r\oot"

     appearing at line 1 of file 'pound.cfg' will result in the
     following message:

          pound.cfg:1.8: unrecognized escape character

     and will be treated as

          user "root"

"IP addresses"
     IP addresses are IPv4 or IPv6 addresses in numeric form, or
     hostnames.


File: pound.info,  Node: Syntax,  Next: String Expansions,  Prev: Lexical structure,  Up: Configuration

10.2 Syntax
===========

Syntactically, 'pound' configuration is a sequence of statements of two
kinds: simple and compound.

   A "simple statement" or "directive" consists of a keyword followed by
a value, located on a single line.  For example:

     user "proxy"

   There are some simple statements that don't take any value and thus
consist only of a keyword, e.g.

     HTTPS

   A "compound statement" or "section" encloses one or more other
statements (both simple or compound).  It begins with a keyword,
optionally followed by a value, both located on a single line (similar
to simple directives), followed by any number of subordinate statements,
and ends with a keyword 'End' on a line by itself.  For example:

     Control
         Socket "/run/pound.sock"
         Mode 660
         ChangeOwner true
     End

   Unless specified otherwise, directives may appear in any order.


File: pound.info,  Node: String Expansions,  Next: Global directives,  Prev: Syntax,  Up: Configuration

10.3 String Expansions
======================

String arguments to some configuration statements undergo several
"expansions" before use.  The "backreference expansion" replaces special
notations in the string called "backreferences" with corresponding parts
of the request recently matched against a regular expression.  The
"request accessor interpretation" inserts some fragments of the request
URL into the string.

   These expansions are discussed in detail below.

* Menu:

* Backreference Expansion::
* Request Accessors::


File: pound.info,  Node: Backreference Expansion,  Next: Request Accessors,  Up: String Expansions

10.3.1 Backreference expansion
------------------------------

Backreference is a construct that refers to a "parenthesized group"
within a regular expression matched by one of service matching
directives (*note Service Selection Statements::).  During backreference
expansion, each occurrence of such construct is replaced with the actual
value of that parenthesized group.

   Syntactically, backreferences can take two forms.  The construct
'$N', where N is a decimal number, refers to Nth parenthesized
subexpression of the most recently matched statement, and the construct
'$N(M)' refers to Nth parenthesized subexpression in the Mth recently
matched statement.  Numbering of subexpressions starts at 1 ('$0' refers
to entire matching string).  Numbering of matches starts at 0.

   For example, given the following statements

     Host -re "www\\.(.+)"
     Header -re -icase "^Content-Type: *(.*)"
     Path "^/static(/.*)?"

'$1' refers to the subgroup of 'Path', '$1(1)' refers to that of
'Header', and '$1(2)' to that of 'Host'.

   Conditional statements can also be tagged (*note tag::).  When
referring to a subexpression in such a statement, the form '$N(T)' can
be used, where T is the tag.  For example, after tagging the statements
in the example above:

     Host -tag "host" -re "www\\.(.+)"
     Header -tag "type" -re -icase "^Content-Type: *(.*)"
     Path -tag "dir" "^/static(/.*)?"

the corresponding strings can be referred to as: '$1' or '$1(dir)',
'$1(type)', and '$1(host)', correspondingly.

   Curly braces may be used to avoid incorrectly parsing text fragment
that follows the reference as being its part.  This is useful if the
reference is immediately followed by a decimal digit or opening
parenthesis, as in: '${1}(text)'.

   To insert a literal dollar or percent sign in the string, use '$$' or
'$%', correspondingly.


File: pound.info,  Node: Request Accessors,  Prev: Backreference Expansion,  Up: String Expansions

10.3.2 Request Accessor Interpretation
--------------------------------------

"Request accessor" is a syntactical construct of the form:

     %[NAME]

where NAME denotes a part of the incoming request to access and square
brackets are part of the construct.  Accessors are interpreted and
replaced with the value of the corresponding part of the request.  Some
accessors take an argument, which is specified after accessor name and
is delimited from it by one or more whitespace characters.

   The following accessors are defined:

 -- Accessor: url
     Request URL.

 -- Accessor: path
     Request path.

 -- Accessor: query
     Query part.

 -- Accessor: param NAME
     The value of the query parameter NAME.

 -- Accessor: header NAME
     The value of HTTP header NAME.

 -- Accessor: host
     Hostname part of the HOST header.  If the latter does not include
     port number, it is equivalent to '%[header host]'.

 -- Accessor: port
     If the value of the 'Host' header includes port number, '%[port]'
     expands to port number with the leading colon character.
     Otherwise, it expands to empty string.

 -- Accessor: remoteip FWD
     Expands to the request originator IP address.  If FWD is 0, expands
     to its real IP, otherwise expands to the IP determined from the
     'X-Forwarded-For' (or similar) header.  *Note %a::, for details.


File: pound.info,  Node: Global directives,  Next: File inclusion,  Prev: String Expansions,  Up: Configuration

10.4 Global directives
======================

Global directives configure the program operation as a whole.  They may
appear anywhere at the global scope of the configuration file, although
it is customary for them to be at its start.

* Menu:

* Runtime directives::
* Worker Settings::
* Proxy Tuning::
* SSL Settings::
* Regexp Settings::
* ACL definition::
* Condition::
* Lua Settings::


File: pound.info,  Node: Runtime directives,  Next: Worker Settings,  Up: Global directives

10.4.1 Runtime directives
-------------------------

 -- Global directive: Daemon BOOL
     When set to 'true' (the default), 'pound' will detach itself from
     the controlling terminal after successful parsing of the
     configuration file and continue operating in the background.

     When set to 'false', 'pound' will continue operating in the
     foreground.

     This setting can be overridden by the '-F' and '-e' command line
     options.

 -- Global directive: Group "GROUP_NAME"
     Sets the group 'pound' will run as.  If not set, the primary group
     of the user (as set by the 'User' directive) will be used.

 -- Global directive: PIDFile "FILENAME"
     Sets the name of the file where to store program PID. This can be
     also be set from command line, using '-p' command line option
     (*note Usage::).

     Notice the following:

       1. Setting this directive to '-' (a dash) turns creation of a PID
          file off.

       2. When running with a supervisor, this file holds PID of the
          supervisor process.  Otherwise, it holds PID of the main This
          means it is always suitable for signalling the program using
          the traditional 'kill `cat filename`' technique.

       3. Before shutting down, 'pound' removes this file.  However, it
          may fail to do so if it switches to privileges of another user
          after startup (at least one of 'User' or 'Group' are set in
          the configuration file) and the file is stored in a directory
          whose permissions forbid write access for that user.

 -- Global directive: Supervisor BOOL
     When running in daemon mode, start a "supervisor" process.  This
     process, in turn, will start main 'pound' process and will further
     monitor it, restarting it if it fails.

     The default is 'true'.

 -- Global directive: LineBufferSize N
     Sets the line buffer size.  Line buffer is used when reading
     request line, backend response status line, and header fields in
     both requests and responses.  Thus, this value limits the maximum
     length allowed for these parts of HTTP messages.  By default, it is
     set to the internal buffer size (4096 bytes, configurable at
     compile time using the '--with-maxbuf' option)(1), and it cannot be
     less than that default.

     Incoming requests with request line longer than that limit will get
     a 414 ('URI Too Long') response.  Requests with one of header
     fields longer than that will be responded with 413 ('Payload Too
     Large') code.

     This global setting can be overridden for each particular listener
     (*note Listener-specific limits::).

 -- Global directive: RootJail "DIRECTORY"
     If this directive is present, 'pound' will use the system 'chroot'
     call to set the root directory of the process to that specified by
     DIRECTORY.  After that, the program won't be able to access any
     files outside that directory.

     Before chrooting, 'pound' makes the necessary preparations to be
     able to access the files it needs during operation, in particular
     user databases supplied with the 'BasicAuth' statements (*note
     Authentication::), and static file directories (*Note ACME::, and
     *note SendFile::).

 -- Global directive: User "USER_NAME"
     Configures the user 'pound' will run as.

   ---------- Footnotes ----------

   (1) To check the value your 'pound' is compiled with, run 'pound -V'


File: pound.info,  Node: Worker Settings,  Next: Proxy Tuning,  Prev: Runtime directives,  Up: Global directives

10.4.2 Worker Settings
----------------------

 -- Global directive: WorkerMinCount N
     Sets minimum number of worker threads that must always be running.
     The default is 5.  *Note Worker model::.

 -- Global directive: WorkerMaxCount N
     Sets maximum number of worker threads.  The default is 128.  *Note
     Worker model::.

 -- Global directive: WorkerIdleTimeout N
     Sets idle timeout for a worker thread, in seconds.  Default is 30
     seconds.  *Note Worker model::.

 -- Global directive: Threads N
     This statement, retained for backward compatibility with previous
     versions of pound, is equivalent to:

          WorkerMinCount N
          WorkerMaxCount N


File: pound.info,  Node: Proxy Tuning,  Next: SSL Settings,  Prev: Worker Settings,  Up: Global directives

10.4.3 Proxy Tuning Directives
------------------------------

 -- Global directive: BackendStats BOOL
     Whether to enable backend statistics collection.  Backend
     statistics consists of the following values:

       1. Total number of requests processed by this backend.
       2. Average time per request.
       3. Standard deviation of the average time per request.

     If enabled, these values are made available via 'poundctl' (*note
     poundctl list::) and telemetry output (*note Metrics::).

 -- Global directive: Balancer ALGO
     Sets the request balancing algorithm to use.  Allowed values for
     ALGO are:

     random
          Use weighted random balancing algorithm.

     iwrr
          Use interleaved weighted round robin balancing.

     *Note Balancer::, for a detailed discussion of these algorithms.

     The 'Balancer' statement in global scope applies to all 'Service'
     definitions in the file that don't contain 'Balancer' definitions
     of their own.

 -- Global directive: HeaderOption OPT ...
     Sets default header addition options.  One or more arguments are
     allowed, each being one of:

     'none'
          Disable additional headers.

     'forwarded'
          Add 'X-Forwarded-For', 'X-Forwarded-Proto', and
          'X-Forwarded-Port' headers.

     'ssl'
          Pass information about SSL certificates in a set of 'X-SSL-*'
          headers.  This will add the following headers:

          X-SSL-Cipher
               SSL version followed by a slash and active cipher
               algorithm.

          X-SSL-Certificate
               The full client certificate (multi-line).

          X-SSL-Issuer
               Information about the certificate issuer (CA).

          X-SSL-Subject
               Information about the certificate owner.

          X-SSL-notAfter
               End of validity date for the certificate.

          X-SSL-notBefore
               Start of validity date for the certificate.

          X-SSL-serial
               Certificate serial number (in decimal).

     The options 'forwarded', and 'ssl' can be prefixed with 'no-' to
     disable their effect.

     The default is:

          HeaderOption forwarded ssl

     This setting can be overridden for a particular listener using the
     'HeadOption' within it.

 -- Global directive: CombineHeaders
     HTTP protocol allows for certain headers to appear in the message
     multiple times.  Namely, multiple headers with the same header name
     are permitted if that header field is defined as a comma-separated
     list.

     The standard specifies that such fields can be combined in a single
     header line, by appending each subsequent field value to the
     combined field value in order, separated by a comma.

     The 'CombineHeaders' statement declares names of the headers to
     which 'pound' is to apply this operation.  Each header name should
     be listed on a separate line, enclosed in double-quotes.  The
     keyword 'End' on a line by itself ends the statement.  E.g.:

          CombineHeaders
              "Accept"
              "Allow"
              "Cache-Control"
          End

     The 'include' statement (*note File inclusion::) can be used in
     'CombineHeaders' statement.

     'Pound' distribution includes file 'mvh.inc', which declares all
     known multiple-value headers in a form suitable for inclusion to
     'pound.cfg'.  This file is installed in the package data directory,
     so that in order to use it, it suffices to add the following to the
     configuration file:

          CombineHeaders
              Include "mvh.inc"
          End


File: pound.info,  Node: SSL Settings,  Next: Regexp Settings,  Prev: Proxy Tuning,  Up: Global directives

10.4.4 SSL Settings
-------------------

 -- Global directive: SSLEngine "NAME"
     Use an OpenSSL hardware acceleration card called NAME.  Available
     only if OpenSSL-engine is installed on your system.

 -- Global directive: ECDHcurve "NAME"
     Use the named curve for elliptical curve encryption.


File: pound.info,  Node: Regexp Settings,  Next: ACL definition,  Prev: SSL Settings,  Up: Global directives

10.4.5 Regular Expression Settings
----------------------------------

 -- Global directive: RegexType TYPE
     Sets the type of regular expressions to use in conditional
     statements.  Allowed values for TYPE are: 'posix' and 'pcre' (or
     'perl'), case-insensitive.  The latter requires compilation time
     support.

     The selected regular expression type remains in effect for all
     conditionals that follow this statement, until next 'RegexType'
     statement or end of the configuration file, whichever occurs first.

     Regular expression type can be set individually for a directive,
     using the '-pcre' or '-posix' option (*note conditional-option::).

     *Note Regular Expressions::, for a detailed discussion.

 -- Global directive: IgnoreCase BOOL
     Ignore case when doing regex matching (default: 'false').  This
     directive sets the default for the following conditionals: 'URL',
     'Path', 'QueryParam', 'Query', 'StringMatch', as well as for the
     'DeleteHeader' modification directive.  Its value can be overridden
     for specific services.

     This statement is deprecated and will be removed in future
     versions.  Please, use the '-icase' option to the conditional
     instead (*note conditional-option::).


File: pound.info,  Node: ACL definition,  Next: Condition,  Prev: Regexp Settings,  Up: Global directives

10.4.6 ACL Definition
---------------------

 -- Global directive: ACL "NAME"
     Define a "named access control list".  An "ACL" is a list of
     network addresses in CIDR notation.  Once defined, the ACL can be
     used in 'Service' statements to limit access to resources (*note
     ACL reference::).

     The statement has two forms: immediate and file reference ACL. In
     "immediate" form, the CIDR list follows the 'ACL' line and is
     terminated with an 'End' directive on a line by itself.  Each
     non-empty line contains a CIDR enclosed in double quotes.  Comments
     and 'Include' statements (*note File inclusion::) are allowed.  For
     example:

          ACL "secure"
             "192.0.2.0/26"
             "203.0.113.0/24"
          End

     The syntax of named "file reference" ACL is:

          ACL "NAME" -file "FILENAME"

     or

          ACL "NAME" -filewatch "FILENAME"

     If FILENAME is relative, it is looked up in the *note include
     directory::.  The syntax of the file is similar to the described
     above, except that CIDRs need not be quoted and 'Include'
     statements are not allowed.  The form with '-file' reads the file
     contents once, at the program startup.  The one with '-filewatch'
     reads it and then monitors that file for changes.  *Note File-based
     Conditions::, for a detailed discussion.


File: pound.info,  Node: Condition,  Next: Lua Settings,  Prev: ACL definition,  Up: Global directives

10.4.7 Condition
----------------

 -- Global directive: Condition "NAME"
     Defines a "detached condition" identified by NAME (which must be
     unique among conditions defined in the configuration file).  This
     line must be followed by one or more conditional directives (*note
     conditionals::) and terminated by an 'End'.

   For example:

     Condition "a"
         ACL -file "secure"
         Path -beg "/admin/"
     End

   Detached conditions can be evaluated in 'Service' and 'Rewrite'
statements using the 'Eval' statement (*note Eval statement::).  For a
detailed discussion, see *note Detached Conditions::.


File: pound.info,  Node: Lua Settings,  Prev: Condition,  Up: Global directives

10.4.8 The 'Lua' statement
--------------------------

Global Lua settings reside in 'Lua' section:

     Lua
        ...
     End

   Following statements are allowed for use in this section:

 -- Lua directive: Load "FILENAME"
     Load Lua source file FILENAME in per-thread mode.  Unless specified
     as an absolute pathname, the file will be looked in the "include
     directory" (*note include directory::).

 -- Lua directive: LoadGlobal "FILENAME"
     Load Lua source file FILENAME in global mode.  Unless specified as
     an absolute pathname, the file will be looked in the "include
     directory" (*note include directory::).

 -- Lua directive: Path "PATH"
     Prepend PATH to the Lua 'package.path'.  This is a
     semicolon-delimited list of patterns that specifies where the Lua
     'require' statement searches for Lua sources.  In patterns, the
     question mark serves as a wildcard and will be replaced by the name
     of the module being loaded.  The path is scanned from left to
     right.

     Multiple 'Path' statements are allowed.  After parsing, the values
     from all 'Path' statements are joined into a single prefix, which
     is then prepended to the defaulut value of 'package.path'.

 -- Lua directive: CPath "PATH"
     Similar to 'Path' (see above), but modifies 'package.cpath', a
     variable that controls where Lua looks for shared libraries.


File: pound.info,  Node: File inclusion,  Next: Logging configuration,  Prev: Global directives,  Up: Configuration

10.5 File inclusion
===================

 -- Global directive: Include "FILE"
     Include FILE as if it were part of the configuration file.  If FILE
     is a relative file name, it will be looked in the "include
     directory" (see below).  If FILE is a shell globbing pattern, all
     regular files matching that pattern will be included, in
     lexicographical order.

     This directive is allowed both at topmost level and in any
     subsections of the configuration file.

 -- Global directive: IncludeDir "DIR"
     Set the "include directory", i.e.  the directory where 'pound'
     looks for relative file names that appear in other configuration
     directives: 'Include', 'BasicAuth', 'ErrorFile' (or 'Err400'
     through 'Err503'), as well as in the argument to '-file'
     ('-filewatch') option in conditionals (*Note -file::, and *note
     File-based Conditions::).

     This directive can appear multiple times.  In that case, the
     directory set by each 'IncludeDir' remains in effect until next one
     redefines it.

     The default value is the system configuration directory as set at
     compile time (you can check its value in the output of 'pound -V').
     This initial value can be changed in the command line using the '-W
     include-dir=DIR' command line option or reset to the current
     working directory using the '-W no-include-dir' option (*note
     Usage::).


File: pound.info,  Node: Logging configuration,  Next: Management interface,  Prev: File inclusion,  Up: Configuration

10.6 Logging configuration
==========================

 -- Global directive: LogFacility NAME
 -- Global directive: LogFacility -
     Sets the 'syslog' facility to use for logging.  Allowed names are:
     'auth', 'authpriv', 'cron', 'daemon', 'ftp', 'kern', 'lpr'.
     'mail', 'news', 'user'.  'uucp', and 'local0' through 'local7'.

     The second form configures "default log destination".  If 'pound'
     runs in foreground, log messages with priority 'LOG_DEBUG' and
     'LOG_INFO' go to stdout, and messages with the remaining priorities
     are printed to stderr.  If 'pound' runs as a daemon, log messages
     go to the syslog facility 'daemon'.

 -- Global directive: LogFormat "NAME" "FORMAT_DEF"
     Define request logging format.  NAME is a string uniquely
     identifying this format, and FORMAT_DEF is the format string
     definition.  *Note Logging::, for a detailed description of format
     definition syntax.

 -- Global directive: LogLevel "NAME"
 -- Global directive: LogLevel N
     Specify the format to use to log HTTP requests.  NAME is a name of
     a custom format, defined earlier using the 'LogFormat' directive,
     or one of six built-in format names.

     If numeric argument is used, it refers to a built-in format by its
     number (0 through 5).

     *Note Logging::, for a detailed description of HTTP request
     logging.

 -- Global directive: LogTag "STRING"
     Sets the string to tag syslog messages with.  By default, it is the
     name of the program (more precisely, the name which was used to
     start it).

 -- Global directive: ForwardedHeader "NAME"
     Defines the name of the HTTP header that carries the list of
     proxies the request has passed through.  Default value is
     'X-Forwarded-For'.  This header is used to determine the originator
     IP address for logging.  *Note %a::, for details.

 -- Global directive: TrustedIP
     Defines a list of "trusted proxy" IP addresses, which is used to
     determine the originator IP. *Note %a::, for details.

     This statement is a special form of 'ACL' statement, described in
     *note ACL::.  It can have in three forms: "anonymous ACL", "file
     reference", or "ACL reference".

     Examples:

       1.      TrustedIP
                 "127.0.0.1/8"
                 "10.16.0.0/16"
               End
       2.      TrustedIP -filewatch "/etc/pound/trustip.acl"
       3.      TrustedIP "proxy_addresses"

 -- Global directive: Anonymise
 -- Global directive: Anonymize
     When logging, replace the last byte of client IP addresses with 0.

     Default: log the client address in full.


File: pound.info,  Node: Management interface,  Next: Timeouts,  Prev: Logging configuration,  Up: Configuration

10.7 Management Interface
=========================

'Pound' provides a management interface, which allows one to obtain
information about the running instance, change state of configured
listeners, services, and backends, etc.  These requests are normally
issued by the poundctl utility (*note poundctl::).

   The management interface is usually made available via a UNIX socket.
Properties of this "control socket" are configured via the 'Control'
statement.  It has two forms: "directive" and "section".

 -- Global directive: Control "FILENAME"
     Create a UNIX socket FILENAME and listen on it for management
     requests.  The file will be owned by the user that started 'pound'
     (normally 'root') and have mode 0600.

   In section form, the 'Control' statement allows for specifying file
mode and, to certain extent, socket file ownership.  The section can
contain the following statements:

 -- Control statement: Socket "FILENAME"
     Specifies the name of the socket file to use.  This is the only
     mandatory statement in the section form.

 -- Control statement: Mode OCTAL
     Sets the mode of the socket file.

 -- Control statement: ChangeOwner BOOL
     This statement takes effect if at least one of 'User' or 'Group'
     global statements is used.  When set to 'true' it will change the
     owner of the socket file to that specified by those two statements.

   An example of using the 'Control' section:

     Control
         Socket "/run/pound.sock"
         Mode 660
         ChangeOwner true
     End

* Menu:

* Service Control::


File: pound.info,  Node: Service Control,  Up: Management interface

10.7.1 Remote Access to Management Interface
--------------------------------------------

To make the management interface available remotely, use the 'Control'
statement in a 'Service' section:

     ListenHTTP
         Address 192.0.2.1
         Port 80
         Service
             Control
         End
     End

   This configuration makes management interface accessible via
'http://192.0.2.1/'.  Due to obvious security implications, you'd be
better off protecting the 'Control' endpoint using HTTPS, ACLs and/or
basic authorization.  The example below illustrates all these
techniques:

     ListenHTTPS
         Address 192.0.2.1
         Port 443
         Cert "/etc/ssl/priv/example.pem"
         Disable TLSv1

         Service
             Not BasicAuth "pound/htpasswd"
             Rewrite response
                 SetHeader "WWW-Authenticate: Basic realm=\"Restricted access\""
             End
             Error 401
         End

         Service
             ACL "secure"
             Control
         End
     End

   *Note Authentication::, for a discussion of 'BasicAuth' statement,
and see *note ACL:: for a discussion of access control lists (this
example assumes that the ACL 'secure' is defined elsewhere in the
configuration file).

   If you wish to make management interface available under a special
path, make sure the path prefix is stripped off, e.g.:

     Service
         URL -re "^/control(/.+)"
         SetURL "$1"
         Control
     End

   *Note Service Request and Response Modification::, for details about
'SetURL' statement and request modification in general.


File: pound.info,  Node: Timeouts,  Next: ListenHTTP,  Prev: Management interface,  Up: Configuration

10.8 Timeouts
=============

Directives discussed in this section set various timeout values.  Their
argument is an integer expressing the value in seconds.

 -- Global directive: Alive N
     Specify how often should 'pound' check for the status of backend
     servers marked as "dead" (i.e.  inaccessible).  It is a good idea
     to set this as low as possible - it will find resurrected hosts
     faster.  However, if you set it too low it will consume resources.

     Default is 30 seconds.

 -- Global directive: Client N
     Specify for how long 'pound' will wait for a client request
     (default: 10 seconds).  It will drop the connection if client
     doesn't send any data within this interval.

     This value can be overridden for specific listeners.

 -- Global directive: TimeOut N
     Specify for how long 'pound' will wait for the backend to respond
     (default: 15 seconds).

     This value can be overridden for specific backends.

 -- Global directive: ConnTO N
     Specify for how long 'pound' will wait for a connection to a
     backend to be established.  Default is the same as the 'TimeOut'
     value.

     This value can be overridden for specific backends.

 -- Global directive: WatcherTTL N
     If file reference ACLs are used on a system that doesn't support
     'inotify' API, this directive defines the interval between two
     successive checks of file modification times.  *Note ACL
     filewatch::, for a detailed discussion of this feature and
     situations when this setting might be useful.

     The default value is 60 seconds.

 -- Global directive: WSTimeOut N
     Specify for how long 'pound' will wait for data from either backend
     or client in a connection upgraded to WebSocket protocol.  Default
     is 600 seconds.

     This value can be overridden for specific backends.

 -- Global directive: Grace N
     How long should 'pound' continue to answer existing connections
     after a receiving a 'INT' or 'HUP' signal (default: 30 seconds).
     The configured listeners are closed immediately.  You can bypass
     this behaviour by stopping 'pound' with a 'TERM' or 'QUIT' signal,
     in which case the program exits without any delay.


File: pound.info,  Node: ListenHTTP,  Next: ListenHTTPS,  Prev: Timeouts,  Up: Configuration

10.9 ListenHTTP
===============

The 'ListenHTTP' section declares a listener operating in plaintext HTTP
mode.  The section declaration begins with the keyword 'ListenHTTP'
optionally followed by a string supplying symbolic name for that
listener, e.g.:

     ListenHTTP "main"
       ...
     End

   The symbolic name can be used in log messages (*note '%{OBJ}N': log
format.) and in 'poundctl' (*note poundctl::) requests to identify that
listener.  If the name is not supplied, the listener can be identified
by its ordinal number (0-based) in the configuration file.

* Menu:

* Listener address::
* Listener-specific limits::
* Error definitions::
* Listener logging::
* Request Modification::
* Response Modification::
* Error response rewriting::
* Service definitions::


File: pound.info,  Node: Listener address,  Next: Listener-specific limits,  Up: ListenHTTP

10.9.1 Listener address
-----------------------

 -- ListenHTTP directive: Address ADDRESS
     The IP address that 'pound' will listen on.  This can be a numeric
     IPv4 or IPv6 address, or a full pathname of a UNIX socket.  To
     listen on all available interfaces, use '0.0.0.0' (for IPv4), or
     '::0' (for both IPv4 and IPv6).

     If neither 'Address' or 'SocketFrom' are supplied, '::0' is
     assumed.

 -- ListenHTTP directive: Port N
     The port number or service name (as per '/etc/services' that this
     listener will listen on.

     If this directive is not given, the default port number is assumed
     (80 for 'ListenHTTP' and 443 for 'ListenHTTPS').

 -- ListenHTTP directive: SocketFrom "PATHNAME"
     Read the socket to listen on from the UNIX socket supplied by
     PATHNAME.  If this parameter is supplied, neither 'Address' nor
     'Port' may be used.  This parameter is intended for use in 'pound'
     testsuite.


File: pound.info,  Node: Listener-specific limits,  Next: Error definitions,  Prev: Listener address,  Up: ListenHTTP

10.9.2 Listener-specific limits
-------------------------------

 -- ListenHTTP directive: Client N
     Specify for how long 'pound' will wait for a client request
     (default: 10 seconds).  It will drop the connection if client
     doesn't send any data within this interval.

     This statement overrides the global timeout value (*note
     Timeouts::) for this particular listener.

 -- ListenHTTP directive: LineBufferSize N
     Sets the line buffer size.  Line buffer is used when reading
     request line, backend response status line, and header fields in
     both requests and responses.  Thus, this value limits the maximum
     length allowed for these parts of HTTP messages.  The default is
     inherited from the global directive (*note line buffer::).

 -- ListenHTTP directive: MaxRequest N
     Limits the maximum allowed size of incoming requests.  A request
     bigger than that will be responded with status 413.

     By default, there is no limit on the request size.

 -- ListenHTTP directive: MaxURI N
     Limits the maximum allowed length of incoming request URI. A
     request with an URI longer than that will be responded with status
     414 ('URI Too Long').

     By default, the limit is set to 'LineBufferSize' (*note line
     buffer::).

 -- ListenHTTP directive: CheckURL "PATTERN"
     Define a pattern that must be matched by each request sent to this
     listener.  A request that does not match will be returned a 501
     status.

 -- ListenHTTP directive: xHTTP N
     Defines which HTTP method are accepted.  The possible values are:

     0
          Accept only standard HTTP methods: 'GET', 'POST', 'HEAD'.
          This is the default.

     1
          Allow also extended HTTP methods: 'PUT', 'PATCH', 'DELETE'.

     2
          Additionally allow standard WebDAV methods: 'LOCK', 'UNLOCK',
          'PROPFIND', 'PROPPATCH', 'SEARCH', 'MKCOL', 'MOVE', 'COPY',
          'OPTIONS', 'TRACE', 'MKACTIVITY', 'CHECKOUT', 'MERGE',
          'REPORT'.

     3
          Additionally allow MS extension WebDAV methods: 'SUBSCRIBE',
          'UNSUBSCRIBE', 'NOTIFY', 'BPROPFIND', 'BPROPPATCH', 'POLL',
          'BMOVE', 'BCOPY', 'BDELETE', 'CONNECT'.


File: pound.info,  Node: Error definitions,  Next: Listener logging,  Prev: Listener-specific limits,  Up: ListenHTTP

10.9.3 Error definitions
------------------------

When 'pound' returns an error status, it uses built-in error-specific
description code and status page template.  These values can be
customized using the 'ErrorFile' statement.

 -- ListenHTTP directive: ErrorFile CODE "FILENAME"
     Read HTML page for HTTP status code CODE from file FILENAME.

     The CODE argument is a three-digit HTTP response status, and
     FILENAME is the name of a file which supplies contents (and,
     optionally, HTTP headers) of the error response.  *Note Error
     responses::, for details about the file and its usage.

   For compatibility with 'pound' versions up to 4.11, the following
statement is also recognized:

     ErrNNN "FILENAME"

where NNN is a three-digit HTTP status code.  This statement is entirely
equivalent to

     ErrorFile NNN "FILENAME"

   'Pound' produces only a subset of all possible status codes, so not
all NNN codes are allowed.  The discussion below lists available HTTP
codes, along with the error description and default error page text.

 -- HTTP status: 400
     'Bad Request'
          Your browser (or proxy) sent a request that this server could
          not understand.

 -- HTTP status: 401
     'Unauthorized'
          This server could not verify that you are authorized to access
          the document requested.  Either you supplied the wrong
          credentials (e.g., bad password), or your browser doesn't
          understand how to supply the credentials required.

 -- HTTP status: 403
     'Forbidden'
          You don't have permission to access this resource.  It is
          either read-protected or not readable by the server.

 -- HTTP status: 404
     'Not Found'
          The requested URL was not found on this server.

 -- HTTP status: 405
     'Method Not Allowed'
          The request method is not supported for the requested
          resource.

 -- HTTP status: 413
     'Payload Too Large'
          The request content is larger than the proxy server is able to
          process.

 -- HTTP status: 414
     'URI Too Long'
          The length of the requested URL exceeds the capacity limit for
          this server.

 -- HTTP status: 429
     'Too Many Requests'
          The remote party sent too many requests in a given amount of
          time.  'Pound' never issues this error by itself.  This code
          is intended for implementing rate-limiting.  *Note
          Rate-limiting::.

 -- HTTP status: 500
     'Internal Server Error'
          The server encountered an internal error and was unable to
          complete your request.

 -- HTTP status: 501
     'Not Implemented'
          The server does not support the action requested.

 -- HTTP status: 503
     'Service Unavailable'
          The server is temporarily unable to service your request due
          to maintenance downtime or capacity problems.  Please try
          again later.


File: pound.info,  Node: Listener logging,  Next: Request Modification,  Prev: Error definitions,  Up: ListenHTTP

10.9.4 Listener logging
-----------------------

Following statements are similar to the ones described in *note Logging
configuration::, but apply only to the listener they appear in.

 -- ListenHTTP directive: LogLevel "NAME"
 -- ListenHTTP directive: LogLevel N
     Specify the format to use to log HTTP requests.  NAME is a name of
     a custom format, defined earlier using the 'LogFormat' directive,
     or one of six built-in format names.

     If numeric argument is used, it refers to a built-in format by its
     number (0 through 5).

     *Note Logging::, for a detailed description of HTTP request
     logging.

 -- ListenHTTP directive: ForwardedHeader "NAME"
     Defines the name of the HTTP header that carries the list of
     proxies the request has passed through.  Default value is
     'X-Forwarded-For'.  This header is used to determine the originator
     IP address for logging.  *Note %a::, for details.

 -- ListenHTTP directive: TrustedIP
     Defines a list of "trusted proxy" IP addresses, which is used to
     determine the originator IP. *Note %a::, for details.


File: pound.info,  Node: Request Modification,  Next: Response Modification,  Prev: Listener logging,  Up: ListenHTTP

10.9.5 Request Modification
---------------------------

The statements discussed in this subsection modify incoming requests
prior to passing them to the backend.  These same set of statements can
also be used in 'Service' section (*note Service::).  When appearing in
both sections, the directive from 'ListenHTTP' ('ListenHTTPS') section
are applied first, followed by directives from the 'Service' section.
Directives from the same section are applied in order of their
appearance.

 -- ListenHTTP Statement: LuaModify "FUNC" ["ARG"...]
     Run Lua function FUNC with supplied arguments.  The function is
     supposed to modify the request.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaModify::, for a detailed discussion.

 -- ListenHTTP directive: RewriteDestination BOOL
     If set to 'true', the 'Destination:' request header will be changed
     to point to the backend with the correct protocol.

 -- ListenHTTP directive: SetURL "URL"
     Set the URL of the incoming request to URL.

 -- ListenHTTP directive: SetPath [-encode] "VALUE"
     Set the path part of the URL to the given string.  If '-encode'
     option is given, the value will be percent-encoded prior to setting
     it.

 -- ListenHTTP directive: SetQuery "VALUE"
     Set the query part of the URL to the given string.  VALUE must be a
     valid query with the special characters properly encoded using
     percent encoding.

 -- ListenHTTP directive: DeleteQuery
     Delete query part of the URL.

 -- ListenHTTP directive: SetQueryParam "NAME" [-encode] "VALUE"
 -- ListenHTTP directive: SetQueryParam "NAME"
     Used with two arguments, sets query parameter NAME to the VALUE.
     If '-encode' is given, VALUE will be percent-encoded prior to being
     assigned to the parameter.  Otherwise, it will be assigned
     verbatim.  The '-encode' option is allowed before NAME argument as
     well.

     Used with one argument, deletes the parameter NAME.

 -- ListenHTTP directive: SetHeader "NAME: VALUE"
 -- ListenHTTP directive: HeaderAdd "NAME: VALUE"
 -- ListenHTTP directive: AddHeader "NAME: VALUE"
     Sets the HTTP header.  If the header NAME already exists, it will
     be overwritten.  Otherwise, new header will be added to the end of
     the header list.

     The 'HeaderAdd' and 'AddHeader' forms are retained for backward
     compatibility with earlier 'pound' versions.  You are advised
     against using them.

 -- ListenHTTP directive: DeleteHeader [OPTIONS] "PATTERN"
     Remove from the request all headers matching PATTERN.  The
     'HeaderRemove' and 'HeadRemove' forms are retained for backward
     compatibility with earlier 'pound' versions.  You are advised
     against using them.

     By default, PATTERN is treated as extended POSIX regular
     expression.  The OPTIONS argument can be used to alter this.  It
     consists of zero or more option flags from the following list:


     Flag                   Meaning
                            
     --------------------------------------------------------------------------
     '-beg'                 Exact match at the beginning of string (prefix
                            match).
                            
     '-case'                Case-sensitive comparison.
                            
     '-contain'             Delete each header where "PATTERN" is a
                            substring.
                            
     '-end'                 Exact match at the end of string (suffix match).
                            
     '-exact'               Use exact string match.
                            
     '-icase'               Case-insensitive comparison.
                            
     '-pcre'                Use Perl-compatible regular expression.
                            *note Regular Expressions::.
                            
     '-perl'                Same as '-pcre'.
                            
     '-posix'               Use POSIX extended regular expression.
                            *note Regular Expressions::.
                            
     '-re'                  Use regular expression match.  This assumes the
                            default regular expression type, as set by the
                            'RegexType' directive
                            (*note Regular Expressions::).

     Table 10.1: Header matching flags for 'DeleteHeader' directive

     The following options are mutually exclusive: '-beg', '-contain',
     '-end', '-exact', '-pcre' ('-perl'), '-posix', '-re'.  If more than
     one of these are used, the last one takes effect.

 -- ListenHTTP directive: HeaderRemove "PATTERN"
 -- ListenHTTP directive: HeadRemove "PATTERN"
     These are obsolete keywords, equivalent to

          DeleteHeader -icase "PATTERN"

* Menu:

* Rewrite::


File: pound.info,  Node: Rewrite,  Up: Request Modification

10.9.5.1 The 'rewrite' statement
................................

The 'Rewrite' block statement associates one or more header modification
directives discussed above with "conditionals", so that request
modification takes place only when the request matches certain
conditions.

   Syntactically, a 'Rewrite' section is:

       Rewrite [ request ]
         CONDITIONAL_DIRECTIVES...
         MODIFICATION_DIRECTIVES...
     [ Else
         CONDITIONAL_DIRECTIVES...
         MODIFICATION_DIRECTIVES... ]
       End

where CONDITIONAL_DIRECTIVES represents one or more "request
conditionals" described below and MODIFICATION_DIRECTIVES stands for one
or more header modification directives.  The 'Else' part is optional;
any number of 'Else' blocks can be supplied, thus providing for
conditional branching.

   The 'Rewrite' statement is processed sequentially until a branch is
found whose CONDITIONAL_DIRECTIVES yield 'true', or 'End' is
encountered.  If a matching branch is found, its MODIFICATION_DIRECTIVES
are applied to the request.

   "Request matching directives" or "request conditionals" are special
statements that, being applied to a HTTP request, yield 'true' or
'false' depending on whether the request satisfies the condition
described in the directive.

   All directive described below can read a list of conditions from a
disk file and reload that list upon any changes.  *Note File-based
Conditions::, for a detailed discussion of this feature.

   The following conditionals are available:

 -- Request Conditional: ACL [-forwarded] "NAME"
     Returns 'true' if the source IP matches one of the CIDRs from the
     named access control list NAME.  The ACL itself must have been
     defined earlier (*note ACL definition::).

     By default, 'ACL' operates on the actual originator IP address.
     This is changed if '-forwarded' is specified, in which case it uses
     an IP determined from the 'X-Forwarded-For' (or similar) header
     (*note %a::).

     *Note ACL::, for a detailed discussion.

 -- Request Conditional: ACL [-forwarded]
     This statement defines an unnamed ACL to match the source IP
     against.  This line must be followed by one or more lines defining
     CIDRs, as described in *note ACL definition::.  The ACL definition
     is finished with an 'End' keyword on a line by itself.

     The '-forwarded' option instructs 'pound' to use source IP address
     determined from the 'X-Forwarded-For' header (*note %a::), instead
     of the actual originator IP.

     Semantically, this statement is equivalent to the named ACL
     reference described above.

     *Note ACL::, for a detailed discussion.

 -- Request Conditional: ACL [-forwarded] -file "FILENAME"
 -- Request Conditional: ACL [-forwarded] -filewatch "FILENAME"
     Defines an unnamed ACL to match the source IP against.  The ACL
     definition is read from the file FILENAME, one CIDR per line.
     Empty lines and comments are allowed.  If FILENAME is relative, it
     is looked up in the *note include directory::.  The form with
     '-file' reads the file contents once, at the program startup.  The
     one with '-filewatch' reads it and then monitors that file for
     changes.  *Note File-based Conditions::, for a detailed discussion.

     The meaning of '-forwarded' is as described above.

 -- Request Conditional: BasicAuth [OPTION] "FILENAME"
     Evaluates to 'true', if the incoming request passes basic
     authorization as described in RFC 7617.  FILENAME is the name of a
     plain text file containing usernames and passwords, created with
     'htpasswd' or similar utility.  Unless the name starts with a
     slash, it is taken relative to the 'IncludeDir' directory (*note
     include directory::).  The file is cached in the memory at startup,
     so that further authorizations do not result in disk operations.
     The file will be reloaded if changed (*note File-based
     Conditions::).

     *Note Authentication::, for a detailed description.

     For consistency with other conditions, 'BasicAuth' accepts the
     following options: '-file' and '-filewatch'.  The latter enables
     the default behavior and so need not be specified explicitly.  The
     former disables file change monitoring.

 -- Request Conditional: Eval "NAME"
     Evaluates the "detached condition" NAME.  The result is cached, so
     that each detached condition is evaluated at most once.  All 'Eval'
     directives referring to its name will reuse the cached value.
     *Note Detached Conditions::, for a detailed discussion.

 -- Request Conditional: Header [OPTIONS] "PATTERN"
 -- Request Conditional: Header "FIELD" [OPTIONS] "PATTERN"
     Evaluates to 'true', if the request contains at least one header
     matching the given PATTERN.  The directive has two forms.  In first
     form, the PATTERN is compared against entire header line.  In
     second form, the FIELD argument supplies the header name, and
     PATTERN the pattern to match against its value (or the name of the
     file to read patterns from, if OPTIONS is '-file' or '-filewatch').

     An example of 'Header' statement in first form:

          Header "^Content-Type:[[:space:]]*text/.+"

     Here's the corresponding statement in second form:

          Header "Content-Type" "text/.+"

     In both forms, PATTERN is treated as case-insensitive POSIX
     extended regular expression.  This can be changed by OPTIONS,
     described below.

     In first form, pattern modification options, such as '-beg' or
     '-contain' apply to entire header line.  In second form, they apply
     to header value only.  For example, you can write:

          Header "Content-Type" -beg "text/"

     to match a request whose 'Content-Type' header _value_ begins with
     'text/', or

          Header -contain "forwarded"

     to match requests that contain any header with the word 'forwarded'
     anywhere, be it header field name or its value.

 -- Request Conditional: Host [OPTIONS] "HOSTNAME"
     Evaluates to 'true', if the 'Host' header matches HOSTNAME.  In the
     absence of OPTIONS, case-insensitive exact match is assumed, i.e.
     this construct is equivalent to

          Header "Host:[[:space:]]*QHOST"

     where QHOST is the HOSTNAME argument in quoted form, i.e.  with all
     characters that have special meaning in regular expressions
     escaped.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

     This statement is provided to facilitate handling of "virtual
     hosts".  *Note Service selection::, for details.

 -- Request Conditional: LuaMatch "FUNC" ["ARG"...]
     Run Lua function FUNC with the supplied arguments.  Use its return
     value (which must be boolean) as the result of the test.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaMatch::, for a detailed discussion.

 -- Request Conditional: Path [OPTIONS] "PATTERN"
     Returns 'true', if the path part of the incoming request matches
     PATTERN.

 -- Request Conditional: Query [OPTIONS] "PATTERN"
     Returns 'true', if the query part of the incoming request matches
     PATTERN.  The argument must be properly percent-encoded, if it
     contains whitespace or other non-printable characters.

     OPTIONS is zero or more conditional options, as discussed in *note
     conditional-option::.

 -- Request Conditional: QueryParam "NAME" [OPTIONS] "PATTERN"
     Returns 'true', if query parameter NAME is defined and its value
     matches PATTERN.

     OPTIONS is zero or more conditional options (*note
     conditional-option::), or '-decode', which instructs the program to
     percent-decode the value prior to comparison.

 -- Request Conditional: StringMatch "STRING" [OPTIONS] "PATTERN"
     Expands STRING as described in *note String Expansions:: and
     matches the resulting value against PATTERN.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

 -- Request Conditional: TBF KEY RATE BURST
     Defines a "token bucket filter" condition.  *Note Rate-limiting::,
     for a detailed discussion.  Arguments are:

     KEY
          A string identifying the bucket.  It is subject to
          backreference expansion and request accessor interpretation,
          as described in *note String Expansions::.

     RATE
          Rate limit.  A single decimal number means requests per
          second.  To specify another time unit, follow the number with
          a slash, another number and optional unit specifier ('s' for
          seconds, 'ms' for milliseconds, and 'us' for microseconds).
          Examples:

               1/2s => "one request per two seconds"
               200/500ms => "200 requests per 500 milliseconds"

     BURST
          Burst value, i.e.  maximum number of tokens the bucket can
          contain.

 -- Request Conditional: URL [OPTIONS] "PATTERN"
     Matches URL of the request.  PATTERN is treated as case-sensitive
     extended regular expression, unless instructed otherwise by OPTIONS
     (see below).

   In these directives, OPTIONS is a whitespace-delimited list of zero
or more options discussed below:

 -- Conditional option: -beg
     Exact match at the beginning of string (prefix match).

 -- Conditional option: -case
     Case-sensitive comparison.

 -- Conditional option: -contain
     Match if PATTERN is a substring of the original value.

 -- Conditional option: -end
     Exact match at the end of string (suffix match).

 -- Conditional option: -exact
     Exact string match.

 -- Conditional option: -file
     Treat PATTERN as the name of a file to read patterns from.  If the
     name is relative, it will be looked up in the *note include
     directory::.  Patterns are read from the file line by line.
     Leading and trailing whitespace is removed.  Empty lines and
     comments (lines starting with '#') are ignored.

 -- Conditional option: -filewatch
     Same as '-file', but the file will be monitored for changes and
     reloaded as soon as such are detected.  *Note File-based
     Conditions::, for a detailed description.

 -- Conditional option: -icase
     Case-insensitive comparison.

 -- Conditional option: -pcre
 -- Conditional option: -perl
     Use Perl-compatible regular expression.  *Note Regular
     Expressions::.

 -- Conditional option: -posix
     Use POSIX extended regular expression.  *Note Regular
     Expressions::.

 -- Conditional option: -re
     Use regular expression match.  This assumes the default regular
     expression type, as set by the 'RegexType' directive (*note Regular
     Expressions::).

 -- Conditional option: -tag "T"
     Tag this conditional with string T.  The tag can be used by another
     statements to refer to substrings obtained when matching this
     pattern.

     For example:

          Host -tag host -re "(www\\.)?(example.(org|com))"
          Header "Content-Type" -tag "type" -re -icase "^application/(.+)"
          Path -tag "path" -re "/public/(.+)"
          SetPath "$3(host)/$1(type)$1(path)"

     *Note Backreference Expansion::, for a detailed discussion of how
     backreferences are expanded in strings.

   The following options are mutually exclusive: '-beg', '-contain',
'-end', '-exact', '-pcre' ('-perl'), '-posix', '-re'.  If more than one
of these are used, the last one takes effect.

   Placing the keyword 'Not' before a header matching directive reverts
its meaning.  For example, the following will match any request whose
URL does not begin with '/static/':

     Not URL -beg "/static/"

   The 'Match' block statement can be used to join multiple conditional
statements.  Its syntax is:

     Match OP
       ...
     End

where ... stands for any number of conditionals, and OP is a boolean
operation: 'AND' or 'OR' (case-insensitive).  For example, the statement

     Match OR
       Host "www.example.net"
       Path -beg "/ssl"
     End

will match if the request 'Host' header has the value 'www.example.net',
or the path part of its URL starts with '/ssl'.  In contrast, the
statement below:

     Match AND
       Host "www.example.net"
       Path -beg "/ssl"
     End

will match only if both these conditions are met.  As a syntactical
short-cut, two or more conditionals appearing outside of 'Match' are
joined by an implicit logical 'AND', so that the latter example is
equivalent to:

     Host "www.example.net"
     Path -beg "/ssl"

   The 'Match' statement, like any other conditional, can be prefixed
with 'Not', which reverts its meaning.


File: pound.info,  Node: Response Modification,  Next: Error response rewriting,  Prev: Request Modification,  Up: ListenHTTP

10.9.6 Response Modification
----------------------------

 -- ListenHTTP directive: RewriteLocation N
     This statement controls whether 'Location:' and 'Content-location:'
     headers in HTTP responses are modified before sending them back to
     the client.

     If N is 0, both headers are left intact.

     If N is 1, the headers are changed as follows.  If they point to
     the backend itself or to the listener (but with the wrong
     protocol), the request host name will be used instead.  This is the
     default.

     If N is 2, do the same, but compare only the backend address; this
     is useful for redirecting a request to an HTTPS listener on the
     same server as the HTTP listener.

     To check whether the location points to the listener or to the
     backend, its hostname part is resolved and the obtained IP address
     (or addresses) are compared with that of listener or backend.  This
     process is affected by the 'dns' feature setting (*note dns::).  If
     it is disabled ('-W no-dns' option is given), no resolving takes
     place.  In this case the location is deemed to point to the
     listener if its hostname part matches that of the incoming request.
     For backends, the hostname is compared with the value of the
     'ServerName' setting of that backend (*note ServerName::), if any.

* Menu:

* rewrite response::


File: pound.info,  Node: rewrite response,  Up: Response Modification

10.9.6.1 The 'Rewrite response' statement.
..........................................

A special form of the 'Rewrite' statement is provided for modifying
headers in the response obtained from a regular backend or generated
with a 'Error' backend, before sending them back to the requesting
server:

       Rewrite response
         CONDITIONAL_DIRECTIVES...
         MODIFICATION_DIRECTIVES...
     [ Else
         CONDITIONAL_DIRECTIVES...
         MODIFICATION_DIRECTIVES... ]
       End

   The conditional directives allowed for use in this statement are:

 -- Rewrite response conditional: Eval "NAME"
     Evaluates the "detached condition" NAME.  The result is cached, so
     that each detached condition is evaluated at most once.  All 'Eval'
     directives referring to its name will reuse the cached value.
     *Note Detached Conditions::, for a detailed discussion.

 -- Rewrite response conditional: Header [OPTIONS] "PATTERN"
     Returns 'true', if the response contains at least one header
     matching the given PATTERN.

 -- Rewrite response conditional: LuaMatch "FUNC" ["ARG"...]
     Run Lua function FUNC with the supplied arguments.  Use its return
     value (which must be boolean) as the result of the test.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaMatch::, for a detailed discussion.

 -- Rewrite response conditional: StringMatch "STRING" [OPTIONS]
          "PATTERN"
     Expands STRING as described in *note String Expansions::, and
     matches the resulting value against PATTERN.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

   Both conditionals treat their PATTERN argument as case-insensitive
POSIX extended regular expression.  *Note conditional-option::, for a
discussion of available OPTIONS.

   The following "response modification" directives are defined:

 -- Response modification: DeleteHeader [OPTIONS] "PATTERN"
     Remove matching headers from the response.  By default, PATTERN is
     treated as extended POSIX regular expression.  Use OPTIONS to alter
     this behavior.  *Note Table 10.1: deleteheader-option, for a list
     of available options.

 -- Response modification: LuaModify "FUNC" ["ARG"...]
     Run Lua function FUNC with supplied arguments.  The function is
     supposed to modify the response.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaModify::, for a detailed discussion.

 -- Response modification: SetHeader "NAME: VALUE"
     Sets the HTTP response header.  Argument undergoes string expansion
     (*Note String Expansions::).  If the header NAME already exists, it
     will be overwritten.  Otherwise, new header will be added to the
     end of the header list.


File: pound.info,  Node: Error response rewriting,  Next: Service definitions,  Prev: Response Modification,  Up: ListenHTTP

10.9.7 Rewriting error responses
--------------------------------

When a regular backend responds with an error, the content (body) of
that response can be replaced with an arbitrary custom page.  For this
to work, the following conditions should be met:

  1. Response status code is one of error codes that 'pound' itself can
     return.  These are listed in *note Error definitions::.
  2. A custom error page is defined for that status code using the
     'ErrorFile' statement.
  3. Error response rewriting is explicitly enabled for the service that
     contains the backend from which the response is obtained, or for
     the listener where that service is located.  To do so use the
     following statement:

 -- ListenHTTP directive: RewriteErrors BOOL
     Enables or disables error response rewriting for that listener.

     The same statement is available for use within a service (see
     below).  The 'RewriteErrors' setting of a service overrides that of
     the listener.


File: pound.info,  Node: Service definitions,  Prev: Error response rewriting,  Up: ListenHTTP

10.9.8 Service definitions
--------------------------

The 'Service' section defines rules that decide to which backend to
route requests received by that listener.  Any number of 'Service'
sections can be present.  When a request is received, the listener
iterates over all services in the order of their appearance in the
configuration and applies the section rules to the request.  If the
rules match the request, the request is forwarded to the backend defined
in that section.

   *Note Service::, for a detailed discussion of the 'Service'
statement.

 -- ListenHTTP statement: ACME DIR
     This statement defines a special service with a built-in backend
     for handling 'ACME' challenge requests.  *Note ACME::, for a
     detailed discussion of its use.

     The DIR argument defines the directory where to look for challenge
     files.


File: pound.info,  Node: ListenHTTPS,  Next: Service,  Prev: ListenHTTP,  Up: Configuration

10.10 ListenHTTPS
=================

The 'ListenHTTPS' section defines a listener that operates in HTTPS. The
section declaration begins with the keyword 'ListenHTTPS' optionally
followed by a string supplying symbolic name for that listener:

     ListenHTTPS "main"
       ...
     End

   The purpose of the symbolic name is the same as in 'ListenHTTP'
statement.  All keywords defined for 'ListenHTTP' can be used for
'ListenHTTPS' as well.  *Note ListenHTTP::, for a detailed discussion of
these.

   Statements specific for this section are:

 -- ListenHTTPS: Cert "FILENAME"
     Specifies the server "certificate".  FILENAME is either a
     certificate file name, or the name of a directory containing
     certificate files.

     A "certificate file" is a file containing the certificate, possibly
     a certificate chain and the signature for this server, in that
     order.

     This directive is mandatory within 'ListenHTTPS'.

     Multiple 'Cert' directives are allowed.  If multiple directives are
     used, the first one is the default certificate, with additional
     certificates used if the client requests them.

     The ordering of the directives is important: the first certificate
     where the CN matches the client request will be used, so put your
     directives in the most-specific-to-least specific order (i.e.
     wildcard certificates after host-specific certificates).

     'Cert' directives must precede all other SSL-specific directives.

 -- ListenHTTPS: ClientCert MODE DEPTH
     Specifies whether the listener must ask for the client's HTTPS
     certificate.  Allowed values for MODE are:

       0. Never ask for the certificate (the default).
       1. Ask for the client certificate.  It is OK if the client
          doesn't present it.
       2. Ask for the client certificate.  Fail if the client doesn't
          present it.
       3. Ask for the client certificate, but don't verify it.

     DEPTH is the depth of verification for a client certificate (up to
     9).  The default depth limit is 9, allowing for the peer
     certificate and additional 9 CA certificates that must be verified.

 -- ListenHTTPS: Disable PROTO
     Disable the SSL protocol PROTO and all lower protocols as well.
     Allowed values for PROTO are: 'SSLv2', 'SSLv3', 'TLSv1', 'TLSv1_1',
     'TLSv1_2'.

     For example:

          Disable TLSv1

     This disables SSLv2, SSLv3 and TLSv1, thus allowing only TLSv1_1
     and TLSv1_2.

 -- ListenHTTPS: Ciphers "CIPHER_LIST"
     This is the list of ciphers that will be accepted by the SSL
     connection; it is a string in the same format as in 'OpenSSL'
     'ciphers' and 'SSL_CTX_set_cipher_list' functions.

 -- ListenHTTPS: SSLHonorCipherOrder BOOL
     If set 'true', the server will broadcast a preference to use
     ciphers in the order supplied in the 'Ciphers' directive.  If the
     value is 'false', the server will accept any cipher from the
     'Ciphers' list.  Default value is 'false'.

 -- ListenHTTPS: SSLAllowClientRenegotiation MODE
     If MODE is 0, client initiated renegotiation will be disabled.
     This will mitigate DoS exploits based on client renegotiation,
     regardless of the patch status of clients and servers related to
     "Secure renegotiation".  If MODE is 1, secure renegotiation is
     supported.  If MODE value is 2, insecure renegotiation is
     supported.

     The default value is 0.

 -- ListenHTTPS: CAlist "FILENAME"
     Set the list of trusted CA's for this server.  The FILENAME is the
     name of a file containing a sequence of CA certificates (in PEM
     format).  The names of the defined CA certificates will be sent to
     the client on connection.

 -- ListenHTTPS: VerifyList "FILENAME"
     Set the certificate authority list.  The FILENAME is the name of a
     file with CA root certificates, in PEM format.

   _Please note_, that there is an important difference between the
'CAlist' and the 'VerifyList'.  The 'CAlist' tells the client (browser)
which client certificates it should send.  The 'VerifyList' defines
which CAs are actually used for the verification of the returned
certificate.

 -- ListenHTTPS: CRLlist "FILENAME"
     Set the "Certificate Revocation List" file.  FILENAME is the name
     of a file that contains the CRLs (in PEM format).

 -- ListenHTTPS: NoHTTPS11 MODE
     Behave like an 'HTTP/1.0' server for HTTPS clients.  If MODE is 0,
     always conform to HTTPS/1.1.  If it is 1, do not allow multiple
     requests on SSL connections.  If the value is 2 (default), disable
     multiple requests on SSL connections only for MSIE clients.


File: pound.info,  Node: Service,  Next: resolver,  Prev: ListenHTTPS,  Up: Configuration

10.11 Service
=============

The 'Service' statements define backends to use and conditions a request
should satisfy in order to be routed to these backends.  These
statements can appear both within 'ListenHTTP' ('ListenHTTPS') sections
and outside of them.  When processing an incoming request, the listener
will first try to match it against services defined within it.  If none
of these services matches the request, it will try to match it against
services defined in the top level.  If a matching service is found, it
will be used to process the request.  Otherwise a 503 ("Service
Unavailable") response will be returned.

   A service is defined by a section statement that begins with the
'Section' keyword, followed by service definition statements and
terminated by 'End' on a line by itself:

     Service "NAME"
       ...
     End

   Optional NAME argument assigns a symbolic name to the service.  That
name is used to identify the service in diagnostic and access log
messages (*note '%{OBJ}N': log format.), metric output (*note
Metrics::), and in 'poundctl' requests (*note poundctl::).  In the
absence of an assigned NAME, the ordinal number of the service in the
enclosing section is used as its identifier.  Service numbers start at
0.

   Following subsections discuss statements that can be used in
'Service' sections.

* Menu:

* Service Selection Statements::
* Service Request and Response Modification::
* Service Logging::
* Backends::
* Session::
* Other Statements::


File: pound.info,  Node: Service Selection Statements,  Next: Service Request and Response Modification,  Up: Service

10.11.1 Service Selection Statements
------------------------------------

Service selection statements define conditions an incoming request must
satisfy in order to be handled by this service.

 -- Service Conditional: ACL "NAME"
     Returns 'true' if the source IP of the request matches one of the
     CIDRs from the named access control list NAME.  The ACL itself must
     have been defined earlier (*note ACL definition::).

     *Note ACL::, for a detailed discussion.

 -- Service Conditional: ACL -file "FILENAME"
 -- Service Conditional: ACL -filewatch "FILENAME"
     Reads ACL definitions from the file FILENAME.  The file shall
     contain unquoted CIDR definitions, each one on a separate line.
     Empty lines and comments (starting with '#' and ending at the
     nearest newline) are ignored.

     If the '-filewatch' option is used, the file will be monitored and
     reloaded automatically as soon as it changes.  *Note File-based
     Conditions::, for a detailed discussion.

 -- Service Conditional: ACL
     This statement defines an unnamed ACL to match the source IP
     against.  This line must be followed by one or more lines defining
     CIDRs, as described in *note ACL definition::.  The ACL definition
     is finished with an 'End' keyword on a line by itself.

     Semantically, this statement is equivalent to the named ACL
     reference described above.

     *Note ACL::, for a detailed discussion.

 -- Service Conditional: BasicAuth [OPTION] "FILENAME"
     Evaluates to 'true', if the incoming request passes basic
     authorization as described in RFC 7617.  FILENAME is the name of a
     plain text file containing usernames and passwords, created with
     'htpasswd' or similar utility.  Unless the name starts with a
     slash, it is taken relative to the 'IncludeDir' directory (*note
     include directory::).  The file is cached in the memory at startup,
     so that further authorizations do not result in disk operations.
     The file will be rescanned upon any change.  *Note File-based
     Conditions::, for a detailed description of this feature.

     *Note Authentication::, for a detailed description.

     For consistency with other conditions, 'BasicAuth' accepts the
     following options: '-file' and '-filewatch'.  The latter enables
     the default behavior and so need not be specified explicitly.  The
     former disables file change monitoring.

 -- Service Conditional: ClientCert "FILENAME"
     Evaluates to 'true' if the client presents the certificate matching
     that from the file FILENAME (PEM format).

     This conditional cannot be used in standalone services (i.e.
     services that are defined in global scope).  It also cannot be used
     if the 'ListenHTTPS' section that hosts the service has the
     'ClientCert' statement on its own.

 -- Service Conditional: Eval "NAME"
     Evaluates the "detached condition" NAME.  The result is cached, so
     that each detached condition is evaluated at most once.  All 'Eval'
     directives referring to its name will reuse the cached value.
     *Note Detached Conditions::, for a detailed discussion.

 -- Service Conditional: Header [OPTIONS] "PATTERN"
     Yields 'true', if the request contains at least one header matching
     the given PATTERN.  By default, PATTERN is treated as
     case-insensitive POSIX extended regular expression.  This can be
     changed by OPTIONS, described below.

 -- Service Conditional: Host [OPTIONS] "HOSTNAME"
     Evaluates to 'true', if the 'Host' header matches HOSTNAME.  In the
     absence of OPTIONS, case-insensitive exact match is assumed, i.e.
     this construct is equivalent to

          Header "Host:[[:space:]]*QHOST"

     where QHOST is the HOSTNAME argument in quoted form, i.e.  with all
     characters that have special meaning in regular expressions
     escaped.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

     This statement is provided to facilitate handling of "virtual
     hosts".  *Note Service selection::, for details.

 -- Service Conditional: LuaMatch "FUNC" ["ARG"...]
     Run Lua function FUNC with the supplied arguments.  Use its return
     value (which must be boolean) as the result of the test.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaMatch::, for a detailed discussion.

 -- Service Conditional: Path [OPTIONS] "PATTERN"
     Returns 'true', if the path part of the incoming request matches
     PATTERN.

 -- Service Conditional: Query [OPTIONS] "PATTERN"
     Returns 'true', if the query part of the incoming request matches
     PATTERN.  The argument must be properly percent-encoded, if it
     contains whitespace or other non-printable characters.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

 -- Service Conditional: QueryParam "NAME" [OPTIONS] "PATTERN"
     Returns 'true', if the value of the query parameter NAME matches
     PATTERN.

     OPTIONS is zero or more conditional options (*note
     conditional-option::), or '-decode', which instructs the program to
     percent-decode the value prior to comparison.

 -- Service Conditional: StringMatch "STRING" [OPTIONS] "PATTERN"
     Expands STRING as described in *note String Expansions::, and
     matches the resulting value against PATTERN.

     *Note conditional-option::, for a detailed discussion of OPTIONS
     and their effect on matching.

 -- Service Conditional: URL [OPTIONS] "PATTERN"
     Matches URL of the request.  PATTERN is treated as case-sensitive
     extended regular expression, unless instructed otherwise by OPTIONS
     (see below).

   The OPTIONS argument in the directives discussed above defines the
comparison algorithm used.  It consists of one or more flags described
in *note conditional-option::.

   Placing the keyword 'Not' before a header matching directive reverts
its meaning.  For example, the following will match any request whose
URL does not begin with '/static/':

     Not URL -beg "/static/"

   The 'Match' block statement can be used to join multiple header
matching directives.  Its syntax is:

     Match OP
       ...
     End

where ... stands for any number of conditionals, and OP is a boolean
operation: 'AND' or 'OR' (case-insensitive).  *Note Match in service
statement::, for a detailed discussion with examples.


File: pound.info,  Node: Service Request and Response Modification,  Next: Service Logging,  Prev: Service Selection Statements,  Up: Service

10.11.2 Request and Response Modification
-----------------------------------------

These statements modify incoming requests prior to passing them to the
backend.  A similar set of statements can be used in listeners (*note
Request Modification::).  In case both the listener and service contain
request modification statements, those from the listener are applied
first, followed by the ones from the service.

 -- Service directive: SetURL "URL"
     Set the URL of the incoming request to URL.

 -- Service directive: SetPath [-encode] "VALUE"
     Set the path part of the URL to the given string.  If '-encode'
     option is given, the value will be percent-encoded prior to setting
     it.

 -- Service directive: SetQuery "VALUE"
     Set the query part of the URL to the given string.  VALUE must be a
     valid query with the special characters properly encoded using
     percent encoding.

 -- Service directive: DeleteQuery
     Delete query part of the URL.

 -- Service directive: SetQueryParam "NAME" [-encode] ["VALUE"]
     Used with two arguments, sets query parameter NAME to the VALUE.
     If '-encode' is given, VALUE will be percent-encoded prior to being
     assigned to the parameter.  Otherwise, it will be assigned
     verbatim.  The '-encode' option is allowed after NAME argument as
     well.

     Used with one argument, deletes the parameter NAME.  characters.

     Used with one argument, deletes the parameter NAME.

 -- Service directive: SetHeader "NAME: VALUE"
 -- Service directive: HeaderAdd "NAME: VALUE"
 -- Service directive: AddHeader "NAME: VALUE"
     Sets the HTTP header.  If the header NAME already exists, it will
     be overwritten.  Otherwise, new header will be added to the end of
     the header list.

     The 'HeaderAdd' and 'AddHeader' forms are retained for backward
     compatibility with earlier 'pound' versions.  You are advised
     against using them.

 -- Service directive: DeleteHeader [OPTIONS] "PATTERN"
 -- Service directive: HeaderRemove [OPTIONS] "PATTERN"
 -- Service directive: HeadRemove [OPTIONS] "PATTERN"
     Remove from the request all headers matching PATTERN.  The
     'HeaderRemove' and 'HeadRemove' forms are retained for backward
     compatibility with earlier 'pound' versions.  You are advised
     against using them.

     By default, PATTERN is treated as extended POSIX regular
     expression.  The OPTIONS argument can be used to alter this.  It
     consists of zero or more option flags, described in *note Table
     10.1: deleteheader-option.

 -- Service Statement: LuaModify "FUNC" ["ARG"...]
     Run Lua function FUNC with supplied arguments.  The function is
     supposed to modify the request.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaModify::, for a detailed discussion.

 -- Service statement: Rewrite [ request | response ] ... End
     This block statement associates one or more header modification
     directives discussed above with "conditionals", so that request
     modification takes place only when the request matches certain
     conditions.

     By default 'Rewrite' statements apply to incoming requests.  The
     subject of rewriting can also be specified explicitly after the
     'Rewrite' keyword.

     *Note Rewrite::, for a detailed discussion of this statement.

     *Note Conditional branches::, for an in-depth discussion with
     examples.

     *Note Modifying responses::, for a discussion of the use of this
     statement to modify responses.

 -- Service directive: RewriteErrors BOOL
     Enables or disables error response rewriting for that service.
     *Note Error response rewriting::, for a detailed discussion.


File: pound.info,  Node: Service Logging,  Next: Backends,  Prev: Service Request and Response Modification,  Up: Service

10.11.3 Service Logging
-----------------------

 -- Service directive: ForwardedHeader "NAME"
     Defines the name of the HTTP header that carries the list of
     proxies the request has passed through.  Default value is
     'X-Forwarded-For'.  This header is used to determine the originator
     IP address for logging.  *Note %a::, for details.

 -- Service directive: TrustedIP
     Defines a list of "trusted proxy" IP addresses, which is used to
     determine the originator IP.

     *Note %a::, for a detailed discussion.

     This statement is a special form of 'ACL' statement, described in
     *note ACL::.  It can appear in three forms: "anonymous ACL", "file
     reference", or "ACL reference".  Examples:

       1.      TrustedIP
                 "127.0.0.1/8"
                 "10.16.0.0/16"
               End
       2.      TrustedIP -filewatch "/etc/pound/trustip.acl"
       3.      TrustedIP "proxy_addresses"

 -- Service directive: LogSuppress CLASS [CLASS...]
     Suppresses HTTP logging for requests that resulted in status codes
     from the specified classes.  Valid classes are:

     info
     1
          '1xx' response codes.

     success
     2
          '2xx' response codes.

     redirect
     3
          '3xx' response codes.

     clterr
     4
          '4xx' response codes.

     srverr
     5
          '5xx' response codes.

     all
          All response codes.

     This statement is designed for services that receive a constant
     stream of similar HTTP requests from a controlled set of IP
     addresses, such as e.g.  Openmetric services.  *Note Metrics::, for
     an example.


File: pound.info,  Node: Backends,  Next: Session,  Prev: Service Logging,  Up: Service

10.11.4 Backends
----------------

* Menu:

* Backend::
* UseBackend::
* Special Backends::


File: pound.info,  Node: Backend,  Next: UseBackend,  Up: Backends

10.11.4.1 Backend
.................

The 'Backend' section defines a regular backend.  The overall syntax, as
for any section statement, is:

     Backend [ "NAME" ]
       ...
     End

   Optional NAME argument assigns a symbolic name to the service.  That
name is used to identify the backend in diagnostic and access log
messages (*note '%{OBJ}N': log format.), metric output (*note
Metrics::), and in 'poundctl' requests (*note poundctl::).  In the
absence of an assigned NAME, the ordinal (0-based) number of the backend
in the enclosing 'Service' is used as its identifier.

   The following statements can be used in a 'Backend' section:

 -- Backend directive: Address IP
     IP address or host name of the backend server.  If the name cannot
     be resolved to a valid address, 'pound' will assume that it
     represents a path to a Unix-domain socket.

     This directive is mandatory.

 -- Backend directive: Disabled BOOL
     Mark this backend as disabled.

     Backends can be enabled or disabled at runtime using the 'poundctl'
     utility (*note enable: poundctl commands.).

     _Note:_ not to be confused with the 'Disable' statement, described
     below.

 -- Backend directive: Port N
     Sets the port number to connect to.  This directive must be present
     if the 'Address' statement contains an IP address.

 -- Backend directive: Priority N
     Sets numeric priority for this backend.  Priorities are used to
     control probability of receiving a request for handling in case of
     multiple backends.  *Note Balancer::, for a detailed discussion.

     Allowed values for N are 1 to 65535.

   Following directives configure "dynamic backends".  *note Dynamic
backends::, for a detailed discussion:

 -- Backend directive: Family NAME
     Defines the address family to look for when resolving hostnames:

     'any'
          Use all address families available.  This is the default.

     'inet'
          Use only IPv4 addresses.

     'inet6'
          Use only IPv6 addresses.

 -- Backend directive: IgnoreSRVWeight BOOL
     When using 'SRV' records, ignore their weight fields.  Instead,
     copy priority of the producing backend to generated backends.

     This directive is valid when used together with 'Resolve srv' (see
     below).

 -- Backend directive: OverrideTTL N
     This directive configures update interval (in seconds) for dynamic
     backends (*note Dynamic backends::).  At the end of each update
     interval, the DNS be queried and dynamic backends reconfigured (if
     needed) according to its responses.  By default, the TTL value
     obtained from previous DNS response is used.

     To configure the interval to retry failed DNS lookups, see
     'RetryInterval', below.

 -- Backend directive: Resolve TYPE
     Declares a dynamic backend.  Valid values for TYPE are

     'first'
          Resolve the symbolic host name and use first IP from the DNS
          response as the address of the created dynamic backend.  Thus,
          this type will produce at most one dynamic backend.

     'all'
          Resolve the symbolic host name and create one backend for each
          address from the DNS response.  This enables load balancing
          between created backends.  Each backend will be assigned the
          same priority.

     'srv'
          Obtain 'SRV' records for the host name and use them to
          generate dynamic backends.  Each record produces new dynamic
          backend of 'Resolve all' type, which creates regular backends
          as described above.  The weight field of the 'SRV' record is
          mapped to the priority field of each generated backend.  The
          priority field determines the balancer group where the backend
          will be hosted.

 -- Backend directive: RetryInterval N
     Retry failed DNS lookups in N seconds.  Default is 600.

     See also the 'RetryInterval' statement in 'Resolver' section (*note
     resolver::).

   The following three directives set various timeout parameters for
backend operations:

 -- Backend directive: ConnTO N
     Sets "connection timeout", i.e.  time to wait for establishing
     connection with the backend (in seconds).

 -- Backend directive: TimeOut N
     Sets the "response timeout", i.e.  time to wait for a response from
     the backend (in seconds).  Default is 15.

 -- Backend directive: WSTimeOut N
     Idle timeout for WebSocket operations, in seconds.  Default value:
     600 (10 minutes).

   Backend servers can use HTTPS as well as plaintext HTTP. The
following directives configure HTTPS backends:

 -- Backend directive: HTTPS
     This directive indicates that the remote server speaks HTTPS.

 -- Backend directive: Cert "FILENAME"
     This specifies the certificate that 'pound' will use as a client.
     The FILENAME is the name of a file containing the certificate,
     possibly a certificate chain and the signature.

 -- Backend directive: Ciphers "CIPHERLIST"
     This is the list of ciphers that will be accepted by the SSL
     connection with the backend (for HTTPS backends); it is a string in
     the same format as used by the OpenSSL functions 'ciphers' and
     'SSL_CTX_set_cipher_list'.

 -- Backend directive: Disable PROTO
     Disable the SSL protocol PROTO and all earlier protocols.  Allowed
     values for PROTO are: 'SSLv2', 'SSLv3', 'TLSv1', 'TLSv1_1',
     'TLSv1_2'.

     _Note:_ not to be confused with the 'Disabled' statement, described
     above.

 -- Backend directive: ServerName "NAME"
     This directive specifies the name to use for server name
     identification ("SNI"). It also rewrites the 'Host:' header for
     this particular backend.  This means you don't have to use
     'SetHeader' in addition to it.


File: pound.info,  Node: UseBackend,  Next: Special Backends,  Prev: Backend,  Up: Backends

10.11.4.2 Globally Defined Backends
...................................

The 'Backend' section described above can also be used at the topmost
level of the configuration file.  Use this if you plan to use same
backend in several different services.

   When used globally the 'Backend' keyword must always be followed by
the backend name in double-quotes.  The assigned name must be unique
among all global backends.

   To include a globally defined backend in a service, use 'UseBackend'
or 'Backend' keywords.

 -- Service directive: UseBackend "NAME"
     Use globally-defined backend NAME in this service.  The backend
     itself may be defined in global scope before or after the 'Service'
     section that uses it.

   The 'UseBackend' keyword adds the backend to the service exactly as
it was defined.  However, it may sometimes be necessary to alter its
priority and state.  To do so, use the 'Backend' section.  If the name
argument specifies a globally-defined backend, the 'Backend' section can
contain only the 'Priority' and 'Disable' statements.


File: pound.info,  Node: Special Backends,  Prev: UseBackend,  Up: Backends

10.11.4.3 Special Backends
..........................

Special backends are backends that don't rely on an external server to
handle the response, but instead are served by 'pound' itself.

 -- Service directive: Error STATUS [FILE]
     Return a particular HTTP status.

     The STATUS argument supplies the HTTP status code to return.

     Optional FILE argument is the name of a disk file with the error
     page content.  If not supplied, the text is determined as usual:
     first the 'ErrorFile STATUS' statement from the enclosing listener
     is consulted.  If it is not present, the default error page is
     used.

     This directive is useful in a catch-all service, which outputs an
     error page if no service matching the incoming request was found.
     *Note Error responses::, for a discussion.

 -- Service directive: LuaBackend "FUNC" ["ARG"...]
     Run Lua function FUNC with the supplied arguments.  The function
     should set the response code (*note http.resp.code::) and fill the
     response body (*note http.resp.body::) prior to returning.  If it
     fails to do so, 'pound' will generate a standard 500 response.

     The FUNC can be either an unqualified function name, or function
     name with module qualifier ('module.func').

     Each ARG is subject to to backreference expansion and request
     accessor interpretation, as discussed in *note Request
     modifications::.

     This statement is available only if 'pound' was built with Lua
     support.  *Note LuaBackend::, for a detailed discussion.

 -- Service directive: Redirect [CODE] "URL"
     Declares a special backend that responds to each request with a
     redirect response.

     Optional CODE can be one of: 301, 302 (the default), 303, 307, or
     308.

     The URL argument specifies the URL to redirect the request to.
     Before use it is expanded as described in *note String
     Expansions::.

     For compatibility with previous 'pound' versions, if no '$N'
     references are found in URL, the following logic is used: if it is
     a "pure" host (i.e.  with no path) then the client will be
     redirected to that host, with the original request path appended.
     If the URL does contain a path (even if it is just a '/'), then the
     request path is ignored.

     *Note Redirects::, for a detailed discussion of this backend and
     its use.

 -- Service directive: SendFile DIR
     Defines a special backend that serves static files from directory
     DIR.  Name of the file to serve is supplied by the request path,
     after applying usual request modifications (*note Request
     Modification::).  By default, the response bears 'Content-Type:
     text/plain' header.  To change this, use 'SetHeader' statement in
     response rewriting (*note rewrite response::).

     The following example defines a service which will serve requests
     to paths beginning with '/about/' from directory
     '/var/lib/pound/static'.  Name of the file to serve is obtained by
     removing the '/about/' prefix from the request pathname.  Content
     type is set to 'text/html':

          Service
              Path -re "/about/(.+)"
              SetPath "$1"
              Rewrite response
                   SetHeader "Content-Type: text/html"
              End
              SendFile "/var/lib/pound/static"
          End

     If DIR is not an absolute file name, it is resolved relative to
     'pound' include directory (*note include directory::).

 -- Service directive: Control
     Defines a special backend that serves "pound management interface".
     *Note Service Control::, for a detailed discussion of this feature.

 -- Service directive: Metrics
     This directive defines a special backend that generates Openmetric
     telemetry output on the given URL. Example usage:

          Service
              URL "/metrics"
              Metrics
          End

     To control access to the telemetry endpoint, use the 'ACL'
     statement (*note ACL::).

     The 'LogSuppress' directive (*note LogSuppress::) is often used in
     openmetric services to suppress logging of served HTTP requests:

          Service
              URL "/metrics"
              Metrics
              ACL "secure"
              LogSuppress success
          End

     The metrics output is discussed in *note Metric Families::.

 -- Service directive: Emergency ... End
     Defines an "emergency backend", which will be used only if all
     other backends become unavailable.  *Note Backend::, for a
     discussion of directives that can be used within 'Emergency'
     section.

     If multiple 'Emergency' sections are defined, an emergency backend
     to use will be selected using the usual balancing technique (*note
     Balancer::).


File: pound.info,  Node: Session,  Next: Other Statements,  Prev: Backends,  Up: Service

10.11.5 Session
---------------

 -- Service directive: Session ... End
     Defines how a service deals with possible HTTP sessions.  Once a
     session is identified, 'pound' will attempt to send all requests
     within that session to the same backend server.

     *Note Sessions::, for a detailed discussion of HTTP sessions and
     their handling.

   The following directives are available for use in 'Session' section.

 -- Session directive: Type TYPE
     Defines the expected type of sessions to handle.  Allowed values
     for TYPE are:

     'IP'
          A session is defined by the source IP. All requests coming
          from the same IP are considered to be in the same session.
          The IP address is defined by the 'ID' statement (see below).

     'BASIC'
          A session is defined by the 'Authentication' HTTP header.  If
          the header is present, and specifies the 'Basic'
          authentication type, user ID is extracted from it.

     'URL'
          A session is identified by the value of a particular query
          parameter.  The name of the parameter is given by the 'ID'
          statement.

     'PARM'
          Sessions are identified by HTTP parameter - a string that
          appears after a semicolon in the URL, such as 'bar' in
          'http://foo.com;bar'.

     'COOKIE'
          Sessions are identified by the value of an HTTP cookie, whose
          name is given by the 'ID' directive.

     'HEADER'
          Sessions are identified by the value of HTTP header whose name
          is given by the 'ID' directive.

 -- Session directive: ID "NAME"
     Specifies the "session identifier": IP address (for 'Type IP'),
     query parameter name (for 'Type URL'), cookie name (for 'Type
     COOKIE'), or header name (for 'Type HEADER').

 -- Session directive: TTL N
     How long can a session be idle (in seconds).  A session that has
     been idle for longer than the specified number of seconds will be
     discarded.  This directive is mandatory.


File: pound.info,  Node: Other Statements,  Prev: Session,  Up: Service

10.11.6 Other Statements
------------------------

 -- Service directive: Disabled BOOL
     If 'true', mark this service as disabled.  Disabled services are
     not used for request processing.  A service can be enabled or
     disabled at runtime using the 'poundctl' utility (*note enable:
     poundctl commands.).

 -- Service directive: Balancer ALGO
     Sets the request balancing algorithm to use.  Allowed values for
     ALGO are:

     random
          Use weighted random balancing algorithm.

     iwrr
          Use interleaved weighted round robin balancing.

     *Note Balancer::, for a detailed discussion of these algorithms.

     This statement overrides the global 'Balancer' statement (*note
     Balancer: Global directives.).

 -- Service directive: IgnoreCase BOOL
     Ignore case when doing regex matching (default: 'false').  This
     directive sets the default for the following service matching
     directives: 'URL', 'Path', 'QueryParam', 'Query', 'StringMatch', as
     well as for the 'DeleteHeader' modification directive.

     This statement is deprecated and will be removed in future
     versions.  Please, use the '-icase' option with the conditional
     directive instead (*note conditional-option::).


File: pound.info,  Node: resolver,  Prev: Service,  Up: Configuration

10.12 Resolver
==============

The 'Resolver' section controls DNS lookups for dynamic backend
generation (*note Dynamic backends::).  It can contain the following
directives:

 -- Resolver: CNAMEChain N
     Maximum allowed length of a "CNAME chain".  CNAME chains are formed
     by DNS CNAME records pointing to another CNAME. Although prohibited
     by the RFC, such usage occurs sometimes in the wild.  By default,
     'pound' does not accept CNAME chains.  If you work with nameservers
     that declare such chains, set this statement to a small integer
     value, defining maximum number of CNAME records in the chain that
     'pound' will accept.  The value of 2 or 3 should suffice in most
     cases.

 -- Resolver: ConfigFile FILE
     Read resolver configuration from FILE.  Default is
     '/etc/resolv.conf'.

 -- Resolver: ConfigText ... End
     The material within this section is read verbatim and used as the
     content of the resolver configuration file.  E.g.:

          Resolver
                  ConfigText
                          domain example.org
                          nameserver 192.0.2.1
                          nameserver 192.0.2.4
                  End
          End

     If both 'ConfigFile' and 'ConfigText' are used, the last statement
     used wins.

 -- Resolver: Debug BOOL
     If set to 'true', enables DNS debugging info.

 -- Resolver: RetryInterval N
     Interval in seconds, after which to retry failed DNS queries or
     queries that returned no RRs.  This value is used unless the
     backend defines its own retry interval value.


File: pound.info,  Node: poundctl,  Next: Emacs,  Prev: Configuration,  Up: Top

11 poundctl
***********

The 'poundctl' command displays status of various objects of the running
instance and allows you to change some of them.

   The program communicates with the running 'pound' daemon via a UNIX
socket or remotely, via HTTP or HTTPS. The URL of the communication
socket can be given explicitly by the '-s' command line option, or
obtained from 'poundctl' or 'pound' configuration files.

   If the '.poundctl' exists in the home directory, the configuration
will be obtained from it.  Otherwise, if 'poundctl' runs on the same
machine as the 'pound' daemon and communicates with it via the UNIX
socket, the program will scan the 'pound.cfg' file for the 'Control'
statement (*note Control statement::) and read the socket file name from
it.  These ways of configuring 'poundctl' are discussed below, in *note
poundctl config::.  In examples below, it is assumed that the socket URL
is obtained from one of configuration files.

   The program invocation syntax is:

     poundctl [OPTIONS] COMMAND OBJECT [ARG]

Here, OPTIONS are command line options, COMMAND is a command verb that
instructs 'poundctl' what to do, OBJECT identifies the 'pound' object to
operate upon (*note objects::), and optional ARG supplies argument to
the command verb.

   Pound objects identifiers are formed in a path-like fashion:

     /LISTENER/SERVICE/BACKEND

where:

LISTENER
     Symbolic name of the listener or its ordinal number in the
     configuration.  If referring to a globally-defined service, or to a
     backend in such a service, a dash is used.

SERVICE
     Symbolic name or ordinal number of the service located in that
     listener.

BACKEND
     Ordinal number of backend in the service.

   Depending on the command, either '/BACKEND' or both
'/SERVICE/BACKEND' may be omitted.

   For example, the following command will disable backend 2 in service
1 of listener 0:

     poundctl disable /0/1/2

   Assuming listener 0 is named 'web', this example can also be written
as:

     poundctl disable /web/1/2

   The following command disables the listener 0 itself:

     poundctl disable /0

   A dash in place of LISTENER refers to the global scope.  Thus, the
following disables service 1 defined in the global scope of 'pound.cfg':

     poundctl disable /-/1

* Menu:

* poundctl commands::
* poundctl remote::
* poundctl config::
* poundctl options::
* poundctl template::


File: pound.info,  Node: poundctl commands,  Next: poundctl remote,  Up: poundctl

11.1 'poundctl' commands
========================

 -- poundctl: core
     Display core statistics.  By default, it includes: server time,
     'pound' daemon version, uptime, and PID, and worker thread
     statistics.

 -- poundctl: list /L/S/B
 -- poundctl: list /L/S
 -- poundctl: list /L
 -- poundctl: list
     Lists status of the given object and its subordinates.  Without
     argument, shows core statistics (see above), all listeners and
     underlying objects, as well as all standalone services.

 -- poundctl: enable /L/S/B
 -- poundctl: enable /L/S
 -- poundctl: enable /L
 -- poundctl: on /L/S/B
 -- poundctl: on /L/S
 -- poundctl: on /L
     Enables listener, service, or backend.

 -- poundctl: disable /L/S/B
 -- poundctl: disable /L/S
 -- poundctl: disable /L
 -- poundctl: off /L/S/B
 -- poundctl: off /L/S
 -- poundctl: off /L
     Disables listener, service, or backend.

 -- poundctl: delete /L/S KEY
     Delete the session with the given key.  Notice that backend may not
     be specified.

 -- poundctl: add /L/S/B KEY
     Add a session with the given KEY.


File: pound.info,  Node: poundctl remote,  Next: poundctl config,  Prev: poundctl commands,  Up: poundctl

11.2 Using 'poundctl' for remote access
=======================================

Starting from version 4.14, 'pound' is able to provide its management
interface via HTTP (*note Service Control::).  To use remote management
interface, supply its URL with the '-s' command line option.  The URL
syntax is:

     SCHEME://[USER[:PASSWORD]@]HOSTNAME[:PORT][/PATH]

where '[]' denote optional parts.  Valid SCHEME values are 'http' and
'https'.  Use USER and PASSWORD if the interface is protected by basic
authentication (*note Authentication::).

   When using 'https' protocol, you may need to supply the "certificate
authority" file using the '-C FILE' option, where FILE is the name of
the file in PEM format.  This option can also take a directory name as
its argument.  In this case all PEM files from that directory will be
loaded.

   To disable peer certificate verification, use the '-k' option.

   If 'pound' configuration requires the client to send its certificate
for authentication (*Note ClientCert::, or *note ClientCert
conditional::), use the '-K FILE' option to supply it.  Its argument,
FILE, is the name of the file with the certificate and key in PEM
format.


File: pound.info,  Node: poundctl config,  Next: poundctl options,  Prev: poundctl remote,  Up: poundctl

11.3 Configuring 'poundctl'
===========================

Upon startup, the program checks if the file '.poundctl' exists in the
user's home directory.  If so, it reads its configuration from it.  The
location of the configuration file can be changed using the environment
variable 'POUNDCTL_CONF'.  If it is defined and has a non-empty value,
its value is taken as the alternative file name to use.  It can be
either absolute file name, or a file name relative to the home
directory.  Setting 'POUNDCTL_CONF' to an empty value disables reading
the configuration.

   If the program cannot determine the socket URL from '.poundctl', it
will attempt to scan 'pound' configuration file, on the assumption that
it runs on the same machine as the daemon and that its 'pound.cfg' file
contains a 'Control' statement (*note Control statement::).  If so, the
socket name is determined from it.

   Otherwise, the control URL has to be given explicitly using the '-s'
command line option.

   The '.poundctl' file has the same syntax as 'pound.cfg': it is a
sequence of "statements" and "sections", separated by arbitrary amount
of empty lines and comments.  A "simple statement" occupies a single
line and consists of a keyword ("directive") and one or more values
separated by whitespace.  A "section" is a compound statement that
encloses other statements and sections.  Sections begin with a keyword,
optionally followed by arguments, and end with a word 'End' on a line by
itself.  All keywords are case-insensitive.

   The following keywords are available in the global scope:

 -- poundctl config: URL "URL"
     Sets the URL of the 'pound' management socket.  The value is either
     the file name of the UNIX socket file, or a remote URL, as
     described in *note poundctl remote::.

 -- poundctl config: CAFile "FILE"
     Name of the certificate authority file.  See also the '-C' option,
     below.

 -- poundctl config: CAPath "DIR"
     Read certificate authority files from the directory DIR.

 -- poundctl config: ClientCert "FILE"
     Supplies the name of the file with client certificate and private
     key, for client authentication.  See also the '-K' option, below.

 -- poundctl config: Verify BOOL
     Enables or disables peer certificate verification.  The default is
     'on'.  See also the '-k' command line option.

 -- poundctl config: TemplateFile "FILE"
     Name of the template file (*note poundctl template::).

 -- poundctl config: TemplatePath "FILE"
     Search path for template files (*note poundctl template::).

 -- poundctl config: TemplateName "NAME"
     Name of the template to use (*note poundctl template::).

* Menu:

* multiple servers::


File: pound.info,  Node: multiple servers,  Up: poundctl config

11.3.1 Multiple Servers Configuration
-------------------------------------

The 'Server' section provides a way to organize management of multiple
'pound' servers.  The idea is that you define the configuration for each
particular 'pound' installation in a separate 'Server' section, and then
use the name of that section to identify the server of interest in the
command line, using the '-S' option:

     poundctl -S web list

   The syntax of the 'Server' section is:

     Server "NAME"
       ...
     End

where NAME is a unique name assigned to that server.  It will be used as
argument to the '-S' option to identify it.  The ellipsis denotes one or
more of the following statements:

 -- poundctl Server: URL URL
     Sets the URL of the 'pound' management socket for that server.  The
     value is either the file name of the UNIX socket file, or a remote
     URL, as described in *note poundctl remote::.

 -- poundctl Server: CAFile FILE
     Name of the certificate authority file.

 -- poundctl Server: CAPath DIR
     Read certificate authority files from the directory DIR.

 -- poundctl Server: ClientCert FILE
     Supplies the name of the file with client certificate and private
     key, for client authentication to that server.

 -- poundctl Server: Verify BOOL
     Enables or disables peer certificate verification.  The default is
     'on'.


File: pound.info,  Node: poundctl options,  Next: poundctl template,  Prev: poundctl config,  Up: poundctl

11.4 'poundctl' options
=======================

The following options are understood by 'poundctl':

'-C FILE'
'-C DIR'
     Read certificate authority files from FILE or from files in DIR.
     *Note poundctl remote::.  This overrides the 'CAFile' or 'CAPath'
     configuration settings (*note poundctl config::).

'-f FILE'
     Read 'pound' configuration from FILE, instead of the default
     configuration file.

'-i N'
     Sets indentation level for JSON output to N columns.

'-j'
     Use JSON output format.

'-K FILE'
     Read client certificate and private key from FILE.  *Note poundctl
     remote::.  This option overrides the 'ClientCert' configuration
     setting (*note poundctl config::).

'-k'
     Disable peer certificate verification.  *Note poundctl remote::.
     This overrides the 'Verify' configuration setting (*note poundctl
     config::).

'-h'
     Shows a short help output and exits.

'-S NAME'
     Operate on server defined by 'Section "NAME"' in the '.poundctl'
     file.  *Note multiple servers::, for a detailed discussion.

'-s SOCKET'
'-s URL'
     Sets pathname of the control socket, or its URL (for remote access,
     *note poundctl remote::).  This overrides the 'URL' configuration
     setting (*note poundctl config::).

'-T FILE'
     Sets the name of the template file to use.  Overrides the
     'TemplateFile' configuration setting (*note poundctl config::).

'-t NAME'
     Defines the name of the template to use, instead of the 'default'.
     This overrides the 'TemplateName' configuration setting (*note
     poundctl config::).

'-V'
     Prints program version, compilation settings, and exits.

'-v'
     Increases output verbosity level.


File: pound.info,  Node: poundctl template,  Prev: poundctl options,  Up: poundctl

11.5 'poundctl' template
========================

Information received from the 'pound' daemon is formatted as a JSON
object.  To produce human-readable output, 'poundctl' uses a "template",
i.e.  a text written in a domain-specific language expressly designed
for that purpose.  The template language complies, in general, with the
specification in <https://pkg.go.dev/text/template>.  *Note Template
syntax::, for a detailed description.

   Templates are stored in template files, which are looked up in the
template search path.  The path is a column-delimited list of
directories or file names.  To locate the template file, the path is
scanned left-to right.  If an element is a regular file name (or a hard
or symbolic link to a regular file), 'poundctl' tries to open that file.
If an element is a directory name, the program tries to open the file
'poundctl.tmpl' in that directory.  If opening succeeds, further
scanning stops and templates are read from that file.

   The default template path is

     ~/.poundctl.tmpl:DATADIR/pound

where DATADIR stands for the program data directory(1).  That is, the
file '.poundctl.tmpl' in the user home directory is searched first, then
the file 'poundctl.tmpl' (without the leading dot) is looked up in the
program data directory.

   The default search path can be changed in the configuration file,
using the 'TemplatePath' statement (*note poundctl config::), or by
setting the environment variable 'POUND_TMPL_PATH'.

   To examine the default value of the search path, use the '-V' command
line option.

   The template file to use can be requested from the command line using
the '-t' option (or 'TemplateFile' configuration setting).  In this
case, template search path in not searched and the supplied file is used
verbatim.

   Unless instructed otherwise, 'poundctl' uses the template 'default'.
You can request another template name using the 'TemplateName'
configuration setting or the '-T' command line option.

   The default 'poundctl.tmpl' file defines two templates: 'default' and
'xml'.

* Menu:

* Template syntax::
* Pipelines::
* Variables::
* Input object::

   ---------- Footnotes ----------

   (1) It is determined at compile time.  Normally it is
'/usr/share/pound' or '/usr/local/share/pound'.


File: pound.info,  Node: Template syntax,  Next: Pipelines,  Up: poundctl template

11.5.1 Template syntax
----------------------

The syntax of 'poundctl' templates is modelled after and mostly
conforming to the specifications of the 'golang' template module(1).

   Templates are executed by applying them to a JSON object.
Annotations in a template refer to attributes of the object to control
execution and derive values to be displayed.  Execution of the template
walks the structure and sets the cursor, represented by a period (called
"dot"), to the value at the current location in the object as execution
proceeds.

   The input text for a template is as ASCII text is arbitrary format.

   Actions (data evaluations or control structures) are delimited by
'{{' and '}}'; all text outside actions is copied to the output
verbatim.

   To aid in formatting template source code, if '{{' is followed
immediately by a minus sign and white space, all trailing white space is
trimmed from the immediately preceding text.  Similarly, if '}}' is
preceded by white space and a minus sign, all leading white space is
trimmed from the immediately following text.  Notice that the presence
of the whitespace in these trim markers is mandatory: '{{- 3}}' trims
the immediately preceding text and outputs '3', while "'{{-3}}' parses
as an action containing the number '-3'.

* Menu:

* Actions::
* Arguments::

   ---------- Footnotes ----------

   (1) <https://pkg.go.dev/text/template>


File: pound.info,  Node: Actions,  Next: Arguments,  Up: Template syntax

11.5.1.1 Actions
................

Here is the list of actions.  "Arguments" and "pipelines" are
evaluations of data, defined in detail in the sections that follow.

'{{ }}'
     Empty action is discarded.  It may be useful to trim the preceding
     or following whitespace, as in

          {{- -}}

'{{/* a comment */}}'
     Comments are discarded.  They may span multiple lines of text.
     Comments do not nest and must start immediately after the opening
     delimiter (with optional dash and whitespace in between).  A
     comment may be followed by any action described below.

     Comments may be used to control trailing and leading whitespace as
     well:

          {{- a comment trimming the surrounding whitespace -}}

'{{ PIPELINE }}'
     The PIPELINE is evaluated, and the default textual representation
     of its value is copied to the output.

'{{if PIPELINE }} T1 {{end}}'
     If the value of the PIPELINE is empty, no output is generated;
     otherwise, T1 is executed.  The empty values are 'null', 'false',
     numeric 0, empty string ('""'), array ('[]'), or object ('{}').
     Dot is unaffected.

'{{if PIPELINE }} T1 {{else}} T0 {{end}}'
     If the value of the pipeline is empty, T0 is executed; otherwise,
     T1 is executed.  Dot is unaffected.

'{{if PIPELINE }} T1 {{else if PIPELINE }} T2 {{else}} T0 {{end}}'
     A shortcut to simplify writing the if-else chains.  Equivalent to
     (newlines added for readability):

          {{if PIPELINE }}
            T1
          {{else -}}
           {{if PIPELINE }}
             T2
           {{else}}
             T0
           {{end}}
          {{end}}

'{{range PIPELINE }} T1 {{end}}'
     The value of PIPELINE must be an object or array.  If it is of
     length zero, nothing is output.  Otherwise, dot is set to the
     successive elements of the array or object and T1 is executed.  For
     objects, the elements will be	visited in sorted key order.

'{{range PIPELINE }} T1 {{else}} T0 {{end}}'
     Same as above, except that if the value of the PIPELINE is of
     length zero, T0 is executed with dot unaffected.

     Within the '{{range}}' action, the following two keywords may
     appear:

     '{{break}}'
          The innermost '{{range PIPELINE}}' loop is ended early,
          stopping the current iteration and bypassing all remaining
          iterations.

     '{{continue}}'
          The current iteration of the innermost '{{range PIPELINE}}'
          loop is stopped, and the loop starts the next iteration.

'{{define "NAME"}} TEXT {{end}}'
     The TEXT is collected and stored for the further use as template
     with the given NAME.  It can be invoked using the '{{template}}'
     action (see below).

'{{template "NAME"}}'
     The template with the specified NAME (see the '{{define}}' above)
     is executed with dot set to 'null'.

'{{template "NAME" VALUE }}'
     The template with the specified NAME (see the '{{define}}' above)
     is executed with dot set to VALUE.

'{{block "NAME" PIPELINE }} T1 {{end}}'
     A block is shorthand for defining a template and then executing it
     in place:

          {{define "NAME"}} T1 {{end}}
          {{template "NAME" PIPELINE}}

'{{with PIPELINE }} T1 {{end}}'
     If the value of the PIPELINE is empty, no output is generated;
     otherwise, dot is set to the value of the PIPELINE and T1 is
     executed.

'{{with PIPELINE }} T1 {{else}} T0 {{end}}'
     Same as above, but if the value of the PIPELINE is empty, T0 is
     executed with dot unchanged.


File: pound.info,  Node: Arguments,  Prev: Actions,  Up: Template syntax

11.5.1.2 Arguments
..................

An "argument" is a simple value, i.e.  any of the following:

   * Numeric value (integer or floating point)
   * Boolean value: 'true' or 'false'.
   * Quoted string.
   * A dot ('.') This represents the cursor value.
   * Attribute: '.ATTR' This is the value of the attribute ATTR in the
     current value (dot).  Attribute references can be nested, as in
     '.Attr.Xattr.Yattr'.
   * A variable reference: '$VAR'.  Here, VAR is the name of the
     variable defined in the 'range' action.  *Note Variables::, below.

   * Function call in parentheses, for grouping.


File: pound.info,  Node: Pipelines,  Next: Variables,  Prev: Template syntax,  Up: poundctl template

11.5.2 Pipelines
----------------

A "pipeline" is a series of one or more "commands" delimited by pipe
sign ('|').  Each "command" is either an argument or a "function call",
in form:

     FUNC ARG1 ARG2...

where FUNC is the name of one of the built-in functions discussed below.

   Pipelines are executed from left to right, with the result of the
previous command implicitly added to the list of arguments of each
subsequent command.  For example, the pipeline

     .attr | eq $x

is equivalent to

     eq $x .attr

i.e.  it calls the built-in function 'eq' with two arguments: the value
of the variable 'x' and attribute 'attr' of the cursor value.

   The following built-in functions are defined:

 -- Template built-in: and A1 A2
     Evaluates to 'true' if pipelines A1 and A2 both evaluate to 'true'.
     Notice, that there is no boolean shortcut evaluation: both
     pipelines are evaluated prior to calling 'and'.

 -- Template built-in: or A1 A2
     Evaluates to 'true' if at least one of the pipelines A1 and A2
     evaluates to 'true'.  Notice, that there is no boolean shortcut
     evaluation: both pipelines are evaluated prior to calling 'or'.

 -- Template built-in: index A1 A2...
     Returns the result of indexing its first argument by the following
     arguments.  Thus, if '.' is an array, then:

          index . 5

     evaluates to its fifth element ('.[5]').

 -- Template built-in: len A1
     Returns the integer length of its argument.

 -- Template built-in: not A1
     Returns 'true' if its argument evaluates to 'false'.

 -- Template built-in: eq A1 A2
     Returns 'true' if both its arguments are equal.  This applies only
     if both A1 and A2 are numeric or if they both are strings.

 -- Template built-in: ne A1 A2
     Returns 'true' if its arguments (both must be numeric or strings)
     are not equal.

 -- Template built-in: lt A1 A2
     Returns 'true' if A1 is numerically less than A2.

 -- Template built-in: le A1 A2
     Returns 'true' if A1 is numerically less than or equal to A2.

 -- Template built-in: gt A1 A2
     Returns 'true' if A1 is numerically greater than A2.

 -- Template built-in: ge A1 A2
     Returns 'true' if A1 is numerically greater than or equal to A2.

 -- Template built-in: even A1
     Returns 'true' if A1, which must evaluate to an integer value, is
     divisible by 2.

 -- Template built-in: printf FMT A1...
     Implements the 'printf' function.  FMT must evaluate to string.
     Rest of arguments is interpreted according to the conversion
     specifications in FMT.  The result is a formatted string.

     In addition to the standard conversion specifications, the '%v'
     specifier is implemented: it formats its argument in the best way,
     depending on its actual type.

 -- Template built-in: typeof A1
     Evaluates to the type of its argument, one of: 'null', 'bool',
     'number', 'integer', 'string', 'array', and 'object'.

 -- Template built-in: exists A1 A2
     A1 must evaluate to an object and A2 to string.  The function
     evaluates to 'true' if the attribute A2 is present in A1.

 -- Template built-in: add A1 A2...
     Returns the sum of its arguments.

 -- Template built-in: sub A1 A2
     Returns the difference 'A1 - A2'.

 -- Template built-in: mul A1 A2
     Multiplies A1 by A2.

 -- Template built-in: div A1 A2
     Divides A1 by A2.


File: pound.info,  Node: Variables,  Next: Input object,  Prev: Pipelines,  Up: poundctl template

11.5.3 Variables
----------------

Variables (referred to as '$NAME') can be defined in 'range' and 'with'
actions.  For 'range', the syntax is:

     {{range $INDEX, $ELEMENT = PIPELINE }} T1 {{end}}

where INDEX and ELEMENT are arbitrary variable names.  When executing
this action, during each iteration $INDEX and $ELEMENT are set to the
index (attribute name) and value of each successive element.  Dot
remains unaffected.

   For 'with', the syntax is:

     {{with $VAR = PIPELINE }} T1 {{end}}

   PIPELINE is evaluated, its result is assigned to $VAR and the T1
block is executed with dot unchanged.

   A variable's scope extends to the 'end' action of the control
structure ('with' or 'range') in which it is declared.  This includes
any nested statements that may appear in between.


File: pound.info,  Node: Input object,  Prev: Variables,  Up: poundctl template

11.5.4 Input object
-------------------

Depending on the request issued by 'poundctl', the invoked template can
receive as its argument ("dot") an object of one of the following types:
"core", "full listing", "listener", "service", or "backend".  Each
object carries an explicit indication of its type in its 'kind'
attribute.  Its possible values are:

'core'
     Core statistics.
'pound'
     Full listing.
'listener'
     Listener statistics.
'service'
     Service statistics.
'backend'
     Backend statistics.

   Structures of each object are discussed in subsections that follow.

* Menu:

* Core listing::
* Full listing::
* Listener object::
* Service object::
* Backend object::


File: pound.info,  Node: Core listing,  Next: Full listing,  Up: Input object

11.5.4.1 Core listing
.....................

A "core" object describes core 'pound' configuration.  It contains the
following attributes:

'kind'
     Identifies the core listing object.  Its value is 'core'.

'pid'
     PID of the running 'pound' daemon.

'version'
     'Pound' version number (string).

'workers'
     Workers statistics.  This is a JSON object with the following
     attributes:

     'active'
          Number of active threads.

     'count'
          Number of threads currently running.

     'max'
          Maximum number of threads.

     'min'
          Minimum number of threads.

     'timeout'
          Thread idle timeout.

'queue_len'
     Number of incoming HTTP requests in the queue (integer).

'timestamp'
     Current time on the server, formatted as ISO 8601 date-time with
     microsecond precision, e.g.: '2023-01-05T22:43:18.071559'.

'uptime'
     Total running time of 'pound' daemon: number of microseconds
     elapsed since its startup.


File: pound.info,  Node: Full listing,  Next: Listener object,  Prev: Core listing,  Up: Input object

11.5.4.2 Full listing
.....................

A full listing contains the following attributes.

'kind'
     Identifies the full listing object.  The value if this attribute is
     'pound'.

'core'
     Core listing.  *Note Core listing::.

'listeners'
     An array of "listener" objects.  See below for a description.

'services'
     An array of "service" objects, representing services defined in the
     global scope of the 'pound' configuration file.


File: pound.info,  Node: Listener object,  Next: Service object,  Prev: Full listing,  Up: Input object

11.5.4.3 Listener
.................

A "listener" object represents a single HTTP or HTTPS listener in
'pound' configuration.  It has the following attributes:

'kind'
     Identifies the listener object.  The value of this attribute is
     'listener'.

'address'
     Address of this listener.  A string formatted as 'IP:PORT'.  for
     IPv4 and IPv6 addresses or containing a socket file name, for UNIX
     sockets.

'protocol'
     Protocol used: either 'http' or 'https'.

'services'
     Array of "service" objects representing services defined in this
     listener.  See below for the definition of a "service" object.

'enabled'
     Boolean.  Whether this listener is enabled or not.

'nohttps11'
     Value of the 'NoHTTPS11' configuration statement for this listener
     (*note NoHTTPS11: ListenHTTPS.). One of: 0, 1, 2.


File: pound.info,  Node: Service object,  Next: Backend object,  Prev: Listener object,  Up: Input object

11.5.4.4 Service
................

A "service" object describes a single service.

'kind'
     Identifies the service object.  The value of this attribute is
     'service'.

'name'
     Symbolic name of this service.

'enabled'
     Boolean.  Whether this service is enabled or not.

'session_type'
     Name of the session handling algorithm for this service.  One of:
     'IP', 'BASIC', 'URL', 'PARM', 'COOKIE', 'HEADER'.

'sessions'
     List of active sessions in this service.  Each session is
     represented as object with the following attributes:

     'key'
          Session key (string).

     'backend'
          Ordinal number of the backend assigned to handle requests with
          this session.

     'expire'
          Expiration time of this session, formatted as
          '1970-01-01T00:00:00.000000' (with microsecond precision).

'backends'
     List of "backends" defined for this service.

'emergency'
     Emergency "backend" object, or 'null' if no such backend is
     defined.


File: pound.info,  Node: Backend object,  Prev: Service object,  Up: Input object

11.5.4.5 Backend
................

The following attributes are always present in each "backend" object:

'kind'
     Identifies the backend object.  The value of this attribute is
     'backend'.

'alive'
     Whether or not this backend is alive.

'conn_to'
     Connection timeout for this backend (seconds).

'enabled'
     Whether or not this backend is enabled.

'io_to'
     I/O timeout for this backend (seconds).

'priority'
     Priority value assigned to this backend.

'protocol'
     Protocol used by this backend: either 'http' or 'https'.

'type'
     Backend type.  One of: 'acme', 'backend', 'control', 'redirect'.

'ws_to'
     Websocket timeout (seconds).

   Depending on the backend type, the following attributes may be
present:

'acme'
     An object of the following structure:

     'path'
          Directory where ACME challenges are stored.

'backend'
     Object:
     'address'
          Backend address.

'redirect'
     Object:
     'url'
          URL to redirect to.
     'code'
          HTTP code for redirection responses.  One of: 301, 302, 307.
     'redir_req'
          Boolean: whether to append the original request path to the
          resulting location.

   If backend statistics is enabled (*note BackendStats::), the 'stats'
object will be present, with the following attributes:

'request_count'
     Total number of requests processed by this backend.
'request_time_avg'
     Average time per request, in nanoseconds.
'request_time_stddev'
     Standard deviation of the above.


File: pound.info,  Node: Emacs,  Next: Metric Families,  Prev: poundctl,  Up: Top

12 Emacs Major Mode
*******************

'Pound' is distributed with 'pound-mode.el', an elisp source which
provides a major mode for editing 'pound' configuration files in GNU
Emacs.  The file is located in 'src' directory of the distribution.  To
install it, follow the instructions below.

   First, select the directory where to place the file.  The directory
must form a part of the 'emacs' 'load-path' (*note (elisp)Library
Search::) variable.  Then, copy 'pound-mode.el' to that directory.
Then, add the following statements to your '.emacs' or site-wide
'site-start.el' file (*note The Emacs Initialization File: (emacs)Init
File.):

     (autoload 'pound-mode "pound-mode")
     (add-to-list 'auto-mode-alist
                  (cons (purecopy "pound\\.cfg\\'") 'pound-mode))

   The first statement loads 'pound' Emacs major mode.  The second one
associates file 'pound.cfg' with that mode, so that each time you load a
file with that name to your editor, it will automatically select
'pound-mode' as its default major mode.  Depending on your customs, you
may further modify 'auto-mode-alist' to associate 'pound-mode' with more
files.  For example, if your main configuration file includes files from
'/etc/pound' directory (*note File inclusion::), it might be a good idea
to add the following:

     (add-to-list 'auto-mode-alist
        (cons (purecopy "pound/.*\\.cfg\\'") 'pound-mode))

   Once these changes done, you can start 'emacs' to see if it correctly
selects the major mode for your 'pound.cfg'.

   The 'pound-mode' major mode highlights 'pound' configuration keywords
and data types, and provides automatic indentation for the configuration
file.  It defines the following key bindings:

<C-M-a>
     Place cursor at the start of the enclosing section.

<C-M-e>
     Place cursor at the end of the enclosing section.

<C-M-\>
     Indent region.

<C-c C-c>
     Check the syntax of the current buffer by running 'pound -c' (*note
     lint::).

   The following customization variables are available:

 -- Customization Variable: pound-basic-offset
     Default indentation increment.  Each nesting level in the
     configuration file will be indented that amount of columns,
     relative to the enclosing section.

     The default value is 8.

 -- Customization Variable: pound-command
     Command line for starting the 'pound' daemon.  Default is 'pound'.

     Use this variable to specify full pathname of the 'pound' binary,
     if it cannot be found using the 'PATH' shell variable, or to supply
     additional options to it.

 -- Customization Variable: pound-include-dir
     Defines 'pound' include directory (*note include directory::).


File: pound.info,  Node: Metric Families,  Next: Time and Date Formats,  Prev: Emacs,  Up: Top

Appendix A Metric Families
**************************

This appendix describes metric families returned in the output of
"openmetrics" 'pound' backends (*note Metrics::).

 -- Metric family: counter pound_uptime
     Number of milliseconds elapsed since 'pound' startup.

 -- Metric family: gauge pound_workers
     Number of pound workers (*note Worker model::).  Indexed by types:

     'active'
          Number of workers currently active.
     'count'
          Number of workers running (both idle and active).
     'min'
          Minimum number of workers as set by the 'WorkerMinCount'
          configuration directive (*note WorkerMinCount: Global
          directives.).
     'max'
          Maximum number of workers as set by the 'WorkerMaxCount'
          configuration directive (*note WorkerMaxCount: Global
          directives.).

     Example:

          pound_workers{type="active"} 2
          pound_workers{type="count"} 5
          pound_workers{type="max"} 128
          pound_workers{type="min"} 5

 -- Metric family: counter pound_queue_len
     Number of connections waiting in the input queue.

 -- Metric family: stateset pound_listener_enabled
     State of a listener: enabled/disabled.  Indexed by the listener
     ordinal number and, if available, its name.

          pound_listener_enabled{listener="0"} 1
          pound_listener_enabled{listener="1",listener_name="plain"} 0
          pound_listener_enabled{listener="2",listener_name="tls"} 1

 -- Metric family: info pound_listener_info
     Description of a listener.  Each instance contains the following
     indices:

     'listener'
          Listener ordinal number.

     'listener_name'
          Listener name, if set in the 'ListenHTTP' or 'ListenHTTPS'
          statement (*note ListenHTTP::).

     'address'
          Listener address.  For INET family, it is formatted as
          'IP:PORT', for UNIX sockets, it is the pathname of the socket.

     'protocol'
          Either 'http' or 'https'.

     The value of this metrics is always '1'.

          pound_listener_info{listener="0",address="/run/pound.sock",protocol="http"} 1
          pound_listener_info{listener="1",listener_name="plain",address="0.0.0.0:80",protocol="http"} 1
          pound_listener_info{listener="2",listener_name="tls",address="0.0.0.0:443",protocol="https"} 1

 -- Metric family: stateset pound_service_enabled
     State of a particular service.

          pound_service_enabled{listener="0",service="0"} 1
          pound_service_enabled{listener="1",service="0"} 1
          pound_service_enabled{listener="1",listener_name="plain",service="0",service_name="redirect"} 0
          pound_service_enabled{listener="2",listener_name="tls",service="0",service_name="metrics"} 1
          pound_service_enabled{listener="2",listener_name="tls",service="1",service_name="web"} 1
          pound_service_enabled{service="0",service_name="fallback"} 1


 -- Metric family: gauge pound_backends
     Number of backends per service: total, alive, enabled, and active
     (both alive and enabled).  Indices:

     'listener'
          Listener ordinal number.  This index is absent for globally
          defined services.

     'listener_name'
          Name of the listener.  Present only if the name is set and not
          empty.

     'service'
          Index of the service in listener (or in global configuration,
          for globally defined services).

     'service_name'
          Name of the service.  Present only if the name is set and not
          empty.

     'state'
          Backend state: 'total', 'alive', 'enabled', or 'active'.

     'service_name'
          Name of the service.  Present only if the name is set and not
          empty.

     Example:

          pound_backends{listener="0",listener_name="plain",service="0",service_name="web",state="total"} 5
          pound_backends{listener="0",listener_name="plain",,service="0",service_name="web",state="enabled"} 3
          pound_backends{listener="0",listener_name="plain",,service="0",service_name="web",state="alive"} 3
          pound_backends{service="0",state="total"} 1
          pound_backends{service="0",state="enabled"} 1
          pound_backends{service="0",state="alive"} 1

 -- Metric family: stateset pound_backend_state
     State of each backend.  Indices:

     'listener'
          Listener ordinal number.  This index is absent for globally
          defined services.

     'listener_name'
          Name of the listener.  Present only if the name is set and not
          empty.

     'service'
          Index of the service in listener (or in global configuration,
          for globally defined services).

     'service_name'
          Name of the service.  Present only if the name is set and not
          empty.

     'backend'
          Index of the backend in service.

     'state'
          'enabled': whether the backend is enabled or not.
          'alive': whether the backend is alive or not.

     Example:

          pound_backend_state{listener="0",service="0",backend="0",state="alive"} 1
          pound_backend_state{listener="0",service="0",backend="0",state="enabled"} 1
          pound_backend_state{listener="0",service="0",backend="1",state="alive"} 1
          pound_backend_state{listener="0",service="0",backend="1",state="enabled"} 0

 -- Metric family: gauge pound_backend_requests
     Number of requests processed by backend.  This metrics is available
     only if backend statistics is enabled (*note BackendStats::).

     Example:

          pound_backend_requests{listener="0",service="0",backend="0"} 40587
          pound_backend_requests{listener="1",service="0",backend="0"} 13858

 -- Metric family: gauge pound_backend_request_time_avg_nanoseconds
     Average time per request spent in backend (nanoseconds).  This
     metrics is available only if backend statistics is enabled (*note
     BackendStats::).

          pound_backend_request_time_avg_nanoseconds{listener="0",service="0",backend="0"} 156254
          pound_backend_request_time_avg_nanoseconds{listener="1",service="2",backend="0"} 26147

 -- Metric family: gauge pound_backend_request_stddev_nanoseconds
     Standard deviation of the average time per request.  This metrics
     is available only if backend statistics is enabled (*note
     BackendStats::).

          pound_backend_request_stddev_nanoseconds{listener="0",service="0",backend="0"} 0
          pound_backend_request_stddev_nanoseconds{listener="1",service="2",backend="0"} 59


File: pound.info,  Node: Time and Date Formats,  Next: Old Control Format,  Prev: Metric Families,  Up: Top

Appendix B Time and Date Formats
********************************

This appendix documents the time format specifications understood by the
'%{FORMAT}t' log format conversion.  Essentially, it is a reproduction
of the man page for GNU 'strftime' function.

   Ordinary characters placed in the format string are reproduced
without conversion.  Conversion specifiers are introduced by a '%'
character, and are replaced as follows:

%a             The abbreviated weekday name according to the
               current locale.
               
%A             The full weekday name according to the current
               locale.
               
%b             The abbreviated month name according to the
               current locale.
               
%B             The full month name according to the current
               locale.
               
               
%c             The preferred date and time representation for
               the current locale.
               
%C             The century number (year/100) as a 2-digit
               integer.
               
%d             The day of the month as a decimal number (range
               01 to 31).
               
%D             Equivalent to '%m/%d/%y'.
               
%e             Like '%d', the day of the month as a decimal
               number, but a leading zero is replaced by a
               space.
               
%E             Modifier: use alternative format, see below
               (*note conversion specs::).
               
%F             Equivalent to '%Y-%m-%d' (the ISO 8601 date
               format).
               
%G             The ISO 8601 year with century as a decimal
               number.  The 4-digit year corresponding to the
               ISO week number (see '%V').  This has the same
               format and value as '%y', except that if the ISO
               week number belongs to the previous or next
               year, that year is used instead.
               
%g             Like '%G', but without century, i.e., with a
               2-digit year (00-99).
               
%h             Equivalent to '%b'.
               
%H             The hour as a decimal number using a 24-hour
               clock (range 00 to 23).
               
%I             The hour as a decimal number using a 12-hour
               clock (range 01 to 12).
               
%j             The day of the year as a decimal number (range
               001 to 366).
               
%k             The hour (24-hour clock) as a decimal number
               (range 0 to 23); single digits are preceded by a
               blank.  (See also '%H'.)
               
%l             The hour (12-hour clock) as a decimal number
               (range 1 to 12); single digits are preceded by a
               blank.  (See also '%I'.)
               
%m             The month as a decimal number (range 01 to 12).
               
%M             The minute as a decimal number (range 00 to 59).
               
%n             A newline character.
               
%O             Modifier: use alternative format, see below
               (*note conversion specs::).
               
%p             Either 'AM' or 'PM' according to the given time
               value, or the corresponding strings for the
               current locale.  Noon is treated as 'pm' and
               midnight as 'am'.
               
%P             Like '%p' but in lowercase: 'am' or 'pm' or a
               corresponding string for the current locale.
               
%r             The time in 'a.m.' or 'p.m.' notation.  In the
               POSIX locale this is equivalent to '%I:%M:%S
               %p'.
               
%R             The time in 24-hour notation ('%H:%M').  For a
               version including the seconds, see '%T' below.
               
               
%s             The number of seconds since the Epoch, i.e.,
               since 1970-01-01 00:00:00 UTC.
               
%S             The second as a decimal number (range 00 to 61).
               
%t             A tab character.
               
%T             The time in 24-hour notation ('%H:%M:%S').
               
%u             The day of the week as a decimal, range 1 to 7,
               Monday being 1.  See also '%w'.
               
%U             The week number of the current year as a decimal
               number, range 00 to 53, starting with the first
               Sunday as the first day of week 01.  See also
               '%V' and '%W'.
               
%V             The ISO 8601:1988 week number of the current
               year as a decimal number, range 01 to 53, where
               week 1 is the first week that has at least 4
               days in the current year, and with Monday as the
               first day of the week.  See also '%U' and '%W'.
               
%w             The day of the week as a decimal, range 0 to 6,
               Sunday being 0.  See also '%u'.
               
%W             The week number of the current year as a decimal
               number, range 00 to 53, starting with the first
               Monday as the first day of week 01.
               
%x             The preferred date representation for the
               current locale without the time.
               
%X             The preferred time representation for the
               current locale without the date.
               
%y             The year as a decimal number without a century
               (range 00 to 99).
               
%Y             The year as a decimal number including the
               century.
               
%z             The time-zone as hour offset from GMT.  Required
               to emit RFC822-conformant dates (using '%a, %d
               %b %Y %H:%M:%S %z')
               
%Z             The time zone or name or abbreviation.
               
%+             The date and time in 'date(1)' format.
               
%%             A literal '%' character.

   Some conversion specifiers can be modified by preceding them by the
'E' or 'O' modifier to indicate that an alternative format should be
used.  If the alternative format or specification does not exist for the
current locale, the behaviour will be as if the unmodified conversion
specification were used.  The Single Unix Specification mentions '%Ec',
'%EC', '%Ex', '%EX', '%Ry', '%EY', '%Od', '%Oe', '%OH', '%OI', '%Om',
'%OM', '%OS', '%Ou', '%OU', '%OV', '%Ow', '%OW', '%Oy', where the effect
of the 'O' modifier is to use alternative numeric symbols (say, roman
numerals), and that of the 'E' modifier is to use a locale-dependent
alternative representation.


File: pound.info,  Node: Old Control Format,  Next: Example Lua modules,  Prev: Time and Date Formats,  Up: Top

Appendix C Old Control Output Format
************************************

Prior to version 4.18, JSON output from 'pound' control interface
differred from the current format (*note Input object::) in several
important aspects:

  1. Objects didn't carry the 'kind' attribute.

  2. The "full listing" object incorporated attributes from the "core"
     listing directly, instead of storing them under the 'core'
     attribute.

  3. The "core listing" object lacked 'uptime' attribute.

   In the absense of explicit indication of the object type being passed
(see pt.  1 above), templates were using an heuristics based on the
presence or absence of certain attribute to deduce the object type in
question.  This heuristic is described in the following pseudo-code
fragment:

     {{if exists . "listeners" }}
       {{/* This is a full listing, as requested by poundctl list. */}}
       ...
     {{else if exists . "services"}}
       {{/* Single listener, as requested by poundctl list /L.
            Notice that this attribute is present in the full listing as
            well, so presence of "listeners" should be checked first. */}}
       ...
     {{else if exists . "backends"}}
       {{/* Single service, as requested by poundctl list /L/S. */}}
       ...
     {{else if exists . "pid"}}
       {{/* Core statistics (poundctl core) */}}
       ...
     {{else}}
       {{/* Backend listing (poundctl list /L/I/B) */}}
       ...
     {{end}}

   For backward compatibility, template file shipped with 'pound'
version 4.19 checks whether 'kind' attribute is present, and if it is
not, falls back to using the heuristics above.


File: pound.info,  Node: Example Lua modules,  Next: GNU Free Documentation License,  Prev: Old Control Format,  Up: Top

Appendix D Example Lua modules
******************************

This appendix provides implementations of some Lua modules used in this
manual.

* Menu:

* jwt.lua::
* cookie.lua::


File: pound.info,  Node: jwt.lua,  Next: cookie.lua,  Up: Example Lua modules

D.1 jwt.lua
===========

This is the implementation of 'jwt.lua' module, used in examples in
*note LuaMatch::.  It provides the following methods:

 -- jwt: parse input
     Parse INPUT and build a new JWT object on success.  Return two
     values: the resulting object, and error message (on failure).

 -- jwt: new payload secret
     Create a new JWT object from PAYLOAD and encrypt it with the
     supplied SECRET.

   The JWT object returned by either of these functions has two methods:

 -- Method on jwt: sign secret
     Sign the object using SECRET.  Return the signed string suitable
     for use in 'Authorization:' HTTP header.

 -- Method on jwt: verify secret
     The reverse operation: verify if the signature of the object
     returned by 'parse' matches SECRET.  Return 'true' if it does and
     'false' otherwise.

   The fields of a JWT object are:

 -- object field of jwt: header
     Header part of JWT, decoded into Lua table.

 -- object field of jwt: payload
     Payload part, decoded into Lua table.

 -- object field of jwt: signature
     Signature part, as a string.

 -- object field of jwt: raw
     A table containing original (undecoded) values of the three parts
     in its fields 'header', 'payload', and 'signature'.

   Full text of 'jwt.lua' follows:

     -- Simple implementation of JWT for Pound documentation.
     -- Supports only HMAC signing algorithms.

     local jwt = {}

     local json = require 'dkjson'
     local base64 = require 'base64'

     local base64url_encoder = base64.makeencoder( '-', '_' )
     local base64url_decoder = base64.makedecoder( '-', '_' )

     -- base64url encoding. RFC 7515, Appendix C.
     local function base64url_encode(s)
        b = base64.encode(s, base64url_encoder)
        return b:gsub('=*$','')
     end

     -- base64url encoding. RFC 7515, Appendix C.
     local function base64url_decode(s)
        n = #s % 4
        if n == 3 then
           s = s .. '='
        elseif n == 2 then
           s = s .. '=='
        elseif n ~= 0 then
           return nil, 'invalid base64 encoding'
        end
        ok, val = pcall(base64.decode, s, base64url_decoder)
        if ok then
           return val
        else
           return nil, val
        end
     end

     local openssl = require 'openssl'

     -- Constant declarator
     local constant = {}
     function constant.declare(t)
        return setmetatable(t, {
     	 __index = function (table, key)
     	    if t[key] then
     	       return t[key]
     	    else
     	       error("No such constant: "..tostring(key))
     	    end
     	 end;
     	 __newindex = function(table, key, value)
     	    error("Attempt to modify read-only table")
     	 end;
     	 __metatable = false;
        });
     end

     setmetatable(constant, {
     		__call = function(_, ...) return constant.declare(...) end
     })

     local S = constant {
        JWT = "JWT",
     }

     local function hmac(alg, secret, message)
        return openssl.hmac.hmac(alg, message, secret, true)
     end

     local sign_algo = constant {
        HS256 = function (secret, message)
     	 return hmac('SHA256', secret, message)
        end;
        HS384 = function (secret, message)
     	 return hmac('SHA384', secret, message)
        end;
        HS512 = function (secret, message)
     	 return hmac('SHA512', secret, message)
        end
     }

     -- Sign a JWT using supplied secret.
     local function jwt_sign(jwt, secret)
        input = jwt.raw.header .. '.' .. jwt.raw.payload
        return base64url_encode(sign_algo[jwt.header.alg](secret, input))
     end

     -- Verify JWT using supplied secret.  Cache result in the
     -- "verified" field.
     local function jwt_verify(jwt, secret)
        if jwt.verified == nil then
           jwt.verified = jwt_sign(jwt, secret) == jwt.raw.signature
        end
        return jwt.verified
     end

     local jwt_metatable = {
        __index = {
           sign = jwt_sign,
           verify = jwt_verify
        }
     }

     -- Create new JWT object from the encoded JWT input.
     -- Return the created object, or nil and textual error description on
     -- error.
     function jwt.parse(input)
        function split(s, n)
           i = s:find("[.]")
           if i == nil then
     	 return s, true
           elseif n == 0 then
     	 return s, false
           else
     	 return s:sub(1,i-1), split(s:sub(i+1),n-1)
           end
        end

        local r = {}
        r['header'], r['payload'], r['signature'], ok = split(input,2)
        if not ok then
           return nil, 'required JWT parts missing'
        end

        local j = { ['raw'] = r }
        local val, err = base64url_decode(r['header'], base64url_decoder)
        if err ~= nil then
           return nil, 'header fails to decode'
        end

        j['header'], _, err = json.decode(val)
        if err then
           return nil, 'malformed header JSON'
        end
        if j.header.typ ~= S.JWT then
           return nil, 'unsupported type'
        end

        val, err = base64url_decode(r['payload'], base64url_decoder)
        if err ~= nil then
           return nil, 'paiload fails to decode'
        end
        j['payload'], _, err = json.decode(val)
        if err then
           return nil, 'malformed payload JSON'
        end
        setmetatable(j, jwt_metatable)
        return j, nil
     end

     function jwt.new(payload, secret)
        local j = {}
        j.header = {
           typ = S.JWT,
           alg = "HS256"
        }
        j.payload = payload
        j.raw = {}
        j.raw.header = base64url_encode(json.encode(j.header))
        j.raw.payload = base64url_encode(json.encode(j.payload))
        return j.raw.header .. '.' .. j.raw.payload .. '.' .. jwt_sign(j,secret)
     end

     return jwt


File: pound.info,  Node: cookie.lua,  Prev: jwt.lua,  Up: Example Lua modules

D.2 cookie.lua
==============

The 'cookie' module, used in *note Cookie injection::, provides the
following two methods:

 -- cookie: get name
     Return value of the cookie NAME from the incoming request, or nil
     if no such cookie is present.

 -- cookie: set name ttl
     Set cookie NAME in the response.  Second argument provides the
     value of 'Max-Age'.

   Full text of 'cookie.lua' follows:

     local _M = {}

     -- Return the value of cookie NAME or nil if it is not set.
     function _M.get(name)
        -- Return true if string S begins with the NAME
        -- followed by an equals sign.
        function is_name(s)
           local i,j = s:find(name..'=')
           if j ~= nil then
              return s:sub(j+1)
           else
              return nil
           end
        end
        -- Given partial value of the Cookie header COOKIE,
        -- find the cookie NAME and return its value.
        local function find_cookie(cookie, name)
           if cookie == nil then
              return nil
           end

           local i, j = cookie:find(";%s*")
           if i == nil then
              return is_name(cookie)
           else
              local s = is_name(cookie:sub(1, i-1))
              if s ~= nil then
                 return s
              else
                 return find_cookie(cookie:sub(j+1), name)
              end
           end
        end

        return find_cookie(http.req.headers['Cookie'], name)
     end

     -- Set cookie NAME to the given VALUE.  Use TTL
     -- as its Max-Age.
     function _M.set(name, value, ttl)
        cv = name .. '=' .. value .. '; Max-Age=' .. ttl
        cookie = http.resp.headers['Set-cookie']
        if cookie == nil then
           cookie = { cv }
        elseif type(cookie) == 'table' then
           table.insert(cookie, cv)
        else
           cookie = { cookie, cv }
        end
        http.resp.headers['Set-cookie'] = cookie
     end

     return _M


File: pound.info,  Node: GNU Free Documentation License,  Next: Index,  Prev: Example Lua modules,  Up: Top

Appendix E GNU Free Documentation License
*****************************************

                     Version 1.3, 3 November 2008

     Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
     <https://fsf.org/>

     Everyone is permitted to copy and distribute verbatim copies
     of this license document, but changing it is not allowed.

  0. PREAMBLE

     The purpose of this License is to make a manual, textbook, or other
     functional and useful document "free" in the sense of freedom: to
     assure everyone the effective freedom to copy and redistribute it,
     with or without modifying it, either commercially or
     noncommercially.  Secondarily, this License preserves for the
     author and publisher a way to get credit for their work, while not
     being considered responsible for modifications made by others.

     This License is a kind of "copyleft", which means that derivative
     works of the document must themselves be free in the same sense.
     It complements the GNU General Public License, which is a copyleft
     license designed for free software.

     We have designed this License in order to use it for manuals for
     free software, because free software needs free documentation: a
     free program should come with manuals providing the same freedoms
     that the software does.  But this License is not limited to
     software manuals; it can be used for any textual work, regardless
     of subject matter or whether it is published as a printed book.  We
     recommend this License principally for works whose purpose is
     instruction or reference.

  1. APPLICABILITY AND DEFINITIONS

     This License applies to any manual or other work, in any medium,
     that contains a notice placed by the copyright holder saying it can
     be distributed under the terms of this License.  Such a notice
     grants a world-wide, royalty-free license, unlimited in duration,
     to use that work under the conditions stated herein.  The
     "Document", below, refers to any such manual or work.  Any member
     of the public is a licensee, and is addressed as "you".  You accept
     the license if you copy, modify or distribute the work in a way
     requiring permission under copyright law.

     A "Modified Version" of the Document means any work containing the
     Document or a portion of it, either copied verbatim, or with
     modifications and/or translated into another language.

     A "Secondary Section" is a named appendix or a front-matter section
     of the Document that deals exclusively with the relationship of the
     publishers or authors of the Document to the Document's overall
     subject (or to related matters) and contains nothing that could
     fall directly within that overall subject.  (Thus, if the Document
     is in part a textbook of mathematics, a Secondary Section may not
     explain any mathematics.)  The relationship could be a matter of
     historical connection with the subject or with related matters, or
     of legal, commercial, philosophical, ethical or political position
     regarding them.

     The "Invariant Sections" are certain Secondary Sections whose
     titles are designated, as being those of Invariant Sections, in the
     notice that says that the Document is released under this License.
     If a section does not fit the above definition of Secondary then it
     is not allowed to be designated as Invariant.  The Document may
     contain zero Invariant Sections.  If the Document does not identify
     any Invariant Sections then there are none.

     The "Cover Texts" are certain short passages of text that are
     listed, as Front-Cover Texts or Back-Cover Texts, in the notice
     that says that the Document is released under this License.  A
     Front-Cover Text may be at most 5 words, and a Back-Cover Text may
     be at most 25 words.

     A "Transparent" copy of the Document means a machine-readable copy,
     represented in a format whose specification is available to the
     general public, that is suitable for revising the document
     straightforwardly with generic text editors or (for images composed
     of pixels) generic paint programs or (for drawings) some widely
     available drawing editor, and that is suitable for input to text
     formatters or for automatic translation to a variety of formats
     suitable for input to text formatters.  A copy made in an otherwise
     Transparent file format whose markup, or absence of markup, has
     been arranged to thwart or discourage subsequent modification by
     readers is not Transparent.  An image format is not Transparent if
     used for any substantial amount of text.  A copy that is not
     "Transparent" is called "Opaque".

     Examples of suitable formats for Transparent copies include plain
     ASCII without markup, Texinfo input format, LaTeX input format,
     SGML or XML using a publicly available DTD, and standard-conforming
     simple HTML, PostScript or PDF designed for human modification.
     Examples of transparent image formats include PNG, XCF and JPG.
     Opaque formats include proprietary formats that can be read and
     edited only by proprietary word processors, SGML or XML for which
     the DTD and/or processing tools are not generally available, and
     the machine-generated HTML, PostScript or PDF produced by some word
     processors for output purposes only.

     The "Title Page" means, for a printed book, the title page itself,
     plus such following pages as are needed to hold, legibly, the
     material this License requires to appear in the title page.  For
     works in formats which do not have any title page as such, "Title
     Page" means the text near the most prominent appearance of the
     work's title, preceding the beginning of the body of the text.

     The "publisher" means any person or entity that distributes copies
     of the Document to the public.

     A section "Entitled XYZ" means a named subunit of the Document
     whose title either is precisely XYZ or contains XYZ in parentheses
     following text that translates XYZ in another language.  (Here XYZ
     stands for a specific section name mentioned below, such as
     "Acknowledgements", "Dedications", "Endorsements", or "History".)
     To "Preserve the Title" of such a section when you modify the
     Document means that it remains a section "Entitled XYZ" according
     to this definition.

     The Document may include Warranty Disclaimers next to the notice
     which states that this License applies to the Document.  These
     Warranty Disclaimers are considered to be included by reference in
     this License, but only as regards disclaiming warranties: any other
     implication that these Warranty Disclaimers may have is void and
     has no effect on the meaning of this License.

  2. VERBATIM COPYING

     You may copy and distribute the Document in any medium, either
     commercially or noncommercially, provided that this License, the
     copyright notices, and the license notice saying this License
     applies to the Document are reproduced in all copies, and that you
     add no other conditions whatsoever to those of this License.  You
     may not use technical measures to obstruct or control the reading
     or further copying of the copies you make or distribute.  However,
     you may accept compensation in exchange for copies.  If you
     distribute a large enough number of copies you must also follow the
     conditions in section 3.

     You may also lend copies, under the same conditions stated above,
     and you may publicly display copies.

  3. COPYING IN QUANTITY

     If you publish printed copies (or copies in media that commonly
     have printed covers) of the Document, numbering more than 100, and
     the Document's license notice requires Cover Texts, you must
     enclose the copies in covers that carry, clearly and legibly, all
     these Cover Texts: Front-Cover Texts on the front cover, and
     Back-Cover Texts on the back cover.  Both covers must also clearly
     and legibly identify you as the publisher of these copies.  The
     front cover must present the full title with all words of the title
     equally prominent and visible.  You may add other material on the
     covers in addition.  Copying with changes limited to the covers, as
     long as they preserve the title of the Document and satisfy these
     conditions, can be treated as verbatim copying in other respects.

     If the required texts for either cover are too voluminous to fit
     legibly, you should put the first ones listed (as many as fit
     reasonably) on the actual cover, and continue the rest onto
     adjacent pages.

     If you publish or distribute Opaque copies of the Document
     numbering more than 100, you must either include a machine-readable
     Transparent copy along with each Opaque copy, or state in or with
     each Opaque copy a computer-network location from which the general
     network-using public has access to download using public-standard
     network protocols a complete Transparent copy of the Document, free
     of added material.  If you use the latter option, you must take
     reasonably prudent steps, when you begin distribution of Opaque
     copies in quantity, to ensure that this Transparent copy will
     remain thus accessible at the stated location until at least one
     year after the last time you distribute an Opaque copy (directly or
     through your agents or retailers) of that edition to the public.

     It is requested, but not required, that you contact the authors of
     the Document well before redistributing any large number of copies,
     to give them a chance to provide you with an updated version of the
     Document.

  4. MODIFICATIONS

     You may copy and distribute a Modified Version of the Document
     under the conditions of sections 2 and 3 above, provided that you
     release the Modified Version under precisely this License, with the
     Modified Version filling the role of the Document, thus licensing
     distribution and modification of the Modified Version to whoever
     possesses a copy of it.  In addition, you must do these things in
     the Modified Version:

       A. Use in the Title Page (and on the covers, if any) a title
          distinct from that of the Document, and from those of previous
          versions (which should, if there were any, be listed in the
          History section of the Document).  You may use the same title
          as a previous version if the original publisher of that
          version gives permission.

       B. List on the Title Page, as authors, one or more persons or
          entities responsible for authorship of the modifications in
          the Modified Version, together with at least five of the
          principal authors of the Document (all of its principal
          authors, if it has fewer than five), unless they release you
          from this requirement.

       C. State on the Title page the name of the publisher of the
          Modified Version, as the publisher.

       D. Preserve all the copyright notices of the Document.

       E. Add an appropriate copyright notice for your modifications
          adjacent to the other copyright notices.

       F. Include, immediately after the copyright notices, a license
          notice giving the public permission to use the Modified
          Version under the terms of this License, in the form shown in
          the Addendum below.

       G. Preserve in that license notice the full lists of Invariant
          Sections and required Cover Texts given in the Document's
          license notice.

       H. Include an unaltered copy of this License.

       I. Preserve the section Entitled "History", Preserve its Title,
          and add to it an item stating at least the title, year, new
          authors, and publisher of the Modified Version as given on the
          Title Page.  If there is no section Entitled "History" in the
          Document, create one stating the title, year, authors, and
          publisher of the Document as given on its Title Page, then add
          an item describing the Modified Version as stated in the
          previous sentence.

       J. Preserve the network location, if any, given in the Document
          for public access to a Transparent copy of the Document, and
          likewise the network locations given in the Document for
          previous versions it was based on.  These may be placed in the
          "History" section.  You may omit a network location for a work
          that was published at least four years before the Document
          itself, or if the original publisher of the version it refers
          to gives permission.

       K. For any section Entitled "Acknowledgements" or "Dedications",
          Preserve the Title of the section, and preserve in the section
          all the substance and tone of each of the contributor
          acknowledgements and/or dedications given therein.

       L. Preserve all the Invariant Sections of the Document, unaltered
          in their text and in their titles.  Section numbers or the
          equivalent are not considered part of the section titles.

       M. Delete any section Entitled "Endorsements".  Such a section
          may not be included in the Modified Version.

       N. Do not retitle any existing section to be Entitled
          "Endorsements" or to conflict in title with any Invariant
          Section.

       O. Preserve any Warranty Disclaimers.

     If the Modified Version includes new front-matter sections or
     appendices that qualify as Secondary Sections and contain no
     material copied from the Document, you may at your option designate
     some or all of these sections as invariant.  To do this, add their
     titles to the list of Invariant Sections in the Modified Version's
     license notice.  These titles must be distinct from any other
     section titles.

     You may add a section Entitled "Endorsements", provided it contains
     nothing but endorsements of your Modified Version by various
     parties--for example, statements of peer review or that the text
     has been approved by an organization as the authoritative
     definition of a standard.

     You may add a passage of up to five words as a Front-Cover Text,
     and a passage of up to 25 words as a Back-Cover Text, to the end of
     the list of Cover Texts in the Modified Version.  Only one passage
     of Front-Cover Text and one of Back-Cover Text may be added by (or
     through arrangements made by) any one entity.  If the Document
     already includes a cover text for the same cover, previously added
     by you or by arrangement made by the same entity you are acting on
     behalf of, you may not add another; but you may replace the old
     one, on explicit permission from the previous publisher that added
     the old one.

     The author(s) and publisher(s) of the Document do not by this
     License give permission to use their names for publicity for or to
     assert or imply endorsement of any Modified Version.

  5. COMBINING DOCUMENTS

     You may combine the Document with other documents released under
     this License, under the terms defined in section 4 above for
     modified versions, provided that you include in the combination all
     of the Invariant Sections of all of the original documents,
     unmodified, and list them all as Invariant Sections of your
     combined work in its license notice, and that you preserve all
     their Warranty Disclaimers.

     The combined work need only contain one copy of this License, and
     multiple identical Invariant Sections may be replaced with a single
     copy.  If there are multiple Invariant Sections with the same name
     but different contents, make the title of each such section unique
     by adding at the end of it, in parentheses, the name of the
     original author or publisher of that section if known, or else a
     unique number.  Make the same adjustment to the section titles in
     the list of Invariant Sections in the license notice of the
     combined work.

     In the combination, you must combine any sections Entitled
     "History" in the various original documents, forming one section
     Entitled "History"; likewise combine any sections Entitled
     "Acknowledgements", and any sections Entitled "Dedications".  You
     must delete all sections Entitled "Endorsements."

  6. COLLECTIONS OF DOCUMENTS

     You may make a collection consisting of the Document and other
     documents released under this License, and replace the individual
     copies of this License in the various documents with a single copy
     that is included in the collection, provided that you follow the
     rules of this License for verbatim copying of each of the documents
     in all other respects.

     You may extract a single document from such a collection, and
     distribute it individually under this License, provided you insert
     a copy of this License into the extracted document, and follow this
     License in all other respects regarding verbatim copying of that
     document.

  7. AGGREGATION WITH INDEPENDENT WORKS

     A compilation of the Document or its derivatives with other
     separate and independent documents or works, in or on a volume of a
     storage or distribution medium, is called an "aggregate" if the
     copyright resulting from the compilation is not used to limit the
     legal rights of the compilation's users beyond what the individual
     works permit.  When the Document is included in an aggregate, this
     License does not apply to the other works in the aggregate which
     are not themselves derivative works of the Document.

     If the Cover Text requirement of section 3 is applicable to these
     copies of the Document, then if the Document is less than one half
     of the entire aggregate, the Document's Cover Texts may be placed
     on covers that bracket the Document within the aggregate, or the
     electronic equivalent of covers if the Document is in electronic
     form.  Otherwise they must appear on printed covers that bracket
     the whole aggregate.

  8. TRANSLATION

     Translation is considered a kind of modification, so you may
     distribute translations of the Document under the terms of section
     4.  Replacing Invariant Sections with translations requires special
     permission from their copyright holders, but you may include
     translations of some or all Invariant Sections in addition to the
     original versions of these Invariant Sections.  You may include a
     translation of this License, and all the license notices in the
     Document, and any Warranty Disclaimers, provided that you also
     include the original English version of this License and the
     original versions of those notices and disclaimers.  In case of a
     disagreement between the translation and the original version of
     this License or a notice or disclaimer, the original version will
     prevail.

     If a section in the Document is Entitled "Acknowledgements",
     "Dedications", or "History", the requirement (section 4) to
     Preserve its Title (section 1) will typically require changing the
     actual title.

  9. TERMINATION

     You may not copy, modify, sublicense, or distribute the Document
     except as expressly provided under this License.  Any attempt
     otherwise to copy, modify, sublicense, or distribute it is void,
     and will automatically terminate your rights under this License.

     However, if you cease all violation of this License, then your
     license from a particular copyright holder is reinstated (a)
     provisionally, unless and until the copyright holder explicitly and
     finally terminates your license, and (b) permanently, if the
     copyright holder fails to notify you of the violation by some
     reasonable means prior to 60 days after the cessation.

     Moreover, your license from a particular copyright holder is
     reinstated permanently if the copyright holder notifies you of the
     violation by some reasonable means, this is the first time you have
     received notice of violation of this License (for any work) from
     that copyright holder, and you cure the violation prior to 30 days
     after your receipt of the notice.

     Termination of your rights under this section does not terminate
     the licenses of parties who have received copies or rights from you
     under this License.  If your rights have been terminated and not
     permanently reinstated, receipt of a copy of some or all of the
     same material does not give you any rights to use it.

  10. FUTURE REVISIONS OF THIS LICENSE

     The Free Software Foundation may publish new, revised versions of
     the GNU Free Documentation License from time to time.  Such new
     versions will be similar in spirit to the present version, but may
     differ in detail to address new problems or concerns.  See
     <https://www.gnu.org/licenses/>.

     Each version of the License is given a distinguishing version
     number.  If the Document specifies that a particular numbered
     version of this License "or any later version" applies to it, you
     have the option of following the terms and conditions either of
     that specified version or of any later version that has been
     published (not as a draft) by the Free Software Foundation.  If the
     Document does not specify a version number of this License, you may
     choose any version ever published (not as a draft) by the Free
     Software Foundation.  If the Document specifies that a proxy can
     decide which future versions of this License can be used, that
     proxy's public statement of acceptance of a version permanently
     authorizes you to choose that version for the Document.

  11. RELICENSING

     "Massive Multiauthor Collaboration Site" (or "MMC Site") means any
     World Wide Web server that publishes copyrightable works and also
     provides prominent facilities for anybody to edit those works.  A
     public wiki that anybody can edit is an example of such a server.
     A "Massive Multiauthor Collaboration" (or "MMC") contained in the
     site means any set of copyrightable works thus published on the MMC
     site.

     "CC-BY-SA" means the Creative Commons Attribution-Share Alike 3.0
     license published by Creative Commons Corporation, a not-for-profit
     corporation with a principal place of business in San Francisco,
     California, as well as future copyleft versions of that license
     published by that same organization.

     "Incorporate" means to publish or republish a Document, in whole or
     in part, as part of another Document.

     An MMC is "eligible for relicensing" if it is licensed under this
     License, and if all works that were first published under this
     License somewhere other than this MMC, and subsequently
     incorporated in whole or in part into the MMC, (1) had no cover
     texts or invariant sections, and (2) were thus incorporated prior
     to November 1, 2008.

     The operator of an MMC Site may republish an MMC contained in the
     site under CC-BY-SA on the same site at any time before August 1,
     2009, provided the MMC is eligible for relicensing.

ADDENDUM: How to use this License for your documents
====================================================

To use this License in a document you have written, include a copy of
the License in the document and put the following copyright and license
notices just after the title page:

       Copyright (C)  YEAR  YOUR NAME.
       Permission is granted to copy, distribute and/or modify this document
       under the terms of the GNU Free Documentation License, Version 1.3
       or any later version published by the Free Software Foundation;
       with no Invariant Sections, no Front-Cover Texts, and no Back-Cover
       Texts.  A copy of the license is included in the section entitled ``GNU
       Free Documentation License''.

   If you have Invariant Sections, Front-Cover Texts and Back-Cover
Texts, replace the "with...Texts." line with this:

         with the Invariant Sections being LIST THEIR TITLES, with
         the Front-Cover Texts being LIST, and with the Back-Cover Texts
         being LIST.

   If you have Invariant Sections without Cover Texts, or some other
combination of the three, merge those two alternatives to suit the
situation.

   If your document contains nontrivial examples of program code, we
recommend releasing these examples in parallel under your choice of free
software license, such as the GNU General Public License, to permit
their use in free software.


File: pound.info,  Node: Index,  Prev: GNU Free Documentation License,  Up: Top

Index
*****

[index]
* Menu:

* %%:                                    Logging.             (line 120)
* %>s:                                   Logging.             (line 237)
* %a:                                    Logging.             (line 123)
* %A:                                    Logging.             (line 169)
* %B:                                    Logging.             (line 172)
* %b:                                    Logging.             (line 175)
* %D:                                    Logging.             (line 179)
* %h:                                    Logging.             (line 182)
* %H:                                    Logging.             (line 185)
* %l:                                    Logging.             (line 196)
* %m:                                    Logging.             (line 214)
* %p:                                    Logging.             (line 221)
* %P:                                    Logging.             (line 224)
* %q:                                    Logging.             (line 227)
* %r:                                    Logging.             (line 231)
* %s:                                    Logging.             (line 234)
* %t:                                    Logging.             (line 240)
* %T:                                    Logging.             (line 264)
* %u:                                    Logging.             (line 274)
* %U:                                    Logging.             (line 277)
* %v:                                    Logging.             (line 281)
* %{FORMAT}t:                            Logging.             (line 244)
* %{HDR}i:                               Logging.             (line 188)
* %{HDR}I:                               Logging.             (line 192)
* %{OBJ}L:                               Logging.             (line 199)
* %{OBJ}N:                               Logging.             (line 217)
* %{UNIT}T:                              Logging.             (line 267)
* -beg:                                  Rewrite.             (line 230)
* -beg, DeleteHeader option:             Request Modification.
                                                              (line  82)
* -c:                                    Usage.               (line  45)
* -C, poundctl:                          poundctl options.    (line   8)
* -case:                                 Rewrite.             (line 233)
* -case, DeleteHeader option:            Request Modification.
                                                              (line  86)
* -contain:                              Rewrite.             (line 236)
* -contain, DeleteHeader option:         Request Modification.
                                                              (line  88)
* -decode:                               Rewrite.             (line 188)
* -decode <1>:                           Service Selection Statements.
                                                              (line 124)
* -e:                                    Usage.               (line  49)
* -encode:                               Request Modification.
                                                              (line  36)
* -encode <1>:                           Request Modification.
                                                              (line  50)
* -encode <2>:                           Service Request and Response Modification.
                                                              (line  16)
* -encode <3>:                           Service Request and Response Modification.
                                                              (line  29)
* -end:                                  Rewrite.             (line 239)
* -end, DeleteHeader option:             Request Modification.
                                                              (line  91)
* -exact:                                Rewrite.             (line 242)
* -exact, DeleteHeader option:           Request Modification.
                                                              (line  93)
* -F:                                    Usage.               (line  55)
* -f:                                    Usage.               (line  62)
* -f, poundctl:                          poundctl options.    (line  14)
* -file:                                 File-based Conditions.
                                                              (line   6)
* -file <1>:                             ACL.                 (line  30)
* -file <2>:                             Rewrite.             (line 245)
* -filewatch:                            File-based Conditions.
                                                              (line   6)
* -filewatch <1>:                        ACL.                 (line  49)
* -filewatch <2>:                        Rewrite.             (line 252)
* -forwarded:                            Rewrite.             (line  48)
* -h:                                    Usage.               (line  66)
* -h, poundctl:                          poundctl options.    (line  34)
* -i, poundctl:                          poundctl options.    (line  18)
* -icase:                                Rewrite.             (line 257)
* -icase, DeleteHeader option:           Request Modification.
                                                              (line  95)
* -j, poundctl:                          poundctl options.    (line  21)
* -k:                                    poundctl options.    (line  29)
* -K, poundctl:                          poundctl options.    (line  24)
* -p:                                    Usage.               (line  69)
* -pcre:                                 Rewrite.             (line 260)
* -pcre, DeleteHeader option:            Request Modification.
                                                              (line  97)
* -perl:                                 Rewrite.             (line 261)
* -perl, DeleteHeader option:            Request Modification.
                                                              (line 100)
* -posix:                                Rewrite.             (line 265)
* -posix, DeleteHeader option:           Request Modification.
                                                              (line 102)
* -re:                                   Rewrite.             (line 269)
* -re, DeleteHeader option:              Request Modification.
                                                              (line 105)
* -S, poundctl:                          poundctl options.    (line  37)
* -s, poundctl:                          poundctl options.    (line  41)
* -S, poundctl option:                   multiple servers.    (line   6)
* -T, poundctl:                          poundctl options.    (line  47)
* -t, poundctl:                          poundctl options.    (line  51)
* -tag:                                  Rewrite.             (line 274)
* -v:                                    Usage.               (line  75)
* -V:                                    Usage.               (line  86)
* -V, poundctl:                          poundctl options.    (line  56)
* -v, poundctl:                          poundctl options.    (line  59)
* -W:                                    Usage.               (line  92)
* .poundctl:                             poundctl config.     (line   6)
* /etc/services:                         Listener address.    (line  16)
* 400:                                   Error definitions.   (line  32)
* 401:                                   Error definitions.   (line  37)
* 403:                                   Error definitions.   (line  44)
* 404:                                   Error definitions.   (line  49)
* 405:                                   Error definitions.   (line  53)
* 413:                                   Error definitions.   (line  58)
* 414:                                   Error definitions.   (line  63)
* 429:                                   Error definitions.   (line  68)
* 500:                                   Error definitions.   (line  75)
* 501:                                   Error definitions.   (line  80)
* 503:                                   Error definitions.   (line  84)
* A record, DNS:                         Dynamic backends.    (line  18)
* AAAA record, DNS:                      Dynamic backends.    (line  18)
* ACL:                                   ACL.                 (line   6)
* ACL <1>:                               ACL definition.      (line   6)
* ACL <2>:                               Rewrite.             (line  43)
* ACL <3>:                               Rewrite.             (line  55)
* ACL <4>:                               Rewrite.             (line  70)
* ACL <5>:                               Rewrite.             (line  71)
* ACL <6>:                               Service Selection Statements.
                                                              (line   9)
* ACL <7>:                               Service Selection Statements.
                                                              (line  16)
* ACL <8>:                               Service Selection Statements.
                                                              (line  17)
* ACL <9>:                               Service Selection Statements.
                                                              (line  27)
* ACME:                                  Service definitions. (line  17)
* add:                                   poundctl commands.   (line  39)
* add <1>:                               Pipelines.           (line  94)
* AddHeader:                             Request Modification.
                                                              (line  60)
* AddHeader <1>:                         Service Request and Response Modification.
                                                              (line  41)
* Address:                               Listener address.    (line   6)
* Address <1>:                           Backend.             (line  22)
* ALERT:                                 Lua API.             (line  43)
* Alive:                                 Timeouts.            (line   9)
* all:                                   Dynamic backends.    (line  89)
* all, log suppression:                  Service Logging.     (line  53)
* and:                                   Pipelines.           (line  29)
* and, logical:                          Service selection.   (line 130)
* Anonymise:                             Logging configuration.
                                                              (line  64)
* Anonymize:                             Logging configuration.
                                                              (line  65)
* any:                                   Dynamic backends.    (line 107)
* Apsis:                                 Overview.            (line  18)
* authentication, basic:                 Authentication.      (line   6)
* backend:                               Introduction.        (line  53)
* Backend:                               Backend.             (line   6)
* backend, external:                     Redirects.           (line   6)
* backend, regular:                      Introduction.        (line  53)
* backend, special:                      Redirects.           (line   6)
* backends, dynamic:                     Dynamic backends.    (line   6)
* BackendStats:                          Proxy Tuning.        (line   6)
* backreference expansion:               Request modifications.
                                                              (line  40)
* Balancer:                              Balancer.            (line  66)
* Balancer <1>:                          Proxy Tuning.        (line  17)
* Balancer <2>:                          Other Statements.    (line  12)
* balancer group:                        Balancer groups.     (line   6)
* balancing:                             Balancer.            (line   6)
* balancing strategy:                    Balancer.            (line  14)
* basic authentication:                  Authentication.      (line   6)
* BASIC, session type:                   Session.             (line  25)
* BasicAuth:                             Authentication.      (line  19)
* BasicAuth <1>:                         Rewrite.             (line  82)
* BasicAuth <2>:                         Service Selection Statements.
                                                              (line  38)
* block:                                 Actions.             (line  89)
* body of resp:                          Lua API.             (line 156)
* boolean value, configuration file:     Lexical structure.   (line  26)
* break:                                 Actions.             (line  67)
* CAFile:                                poundctl config.     (line  40)
* CAFile <1>:                            multiple servers.    (line  29)
* CAlist:                                ListenHTTPS.         (line  91)
* CAPath:                                poundctl config.     (line  44)
* CAPath <1>:                            multiple servers.    (line  32)
* case insensitive match, DeleteHeader:  Request Modification.
                                                              (line  86)
* case insensitive matching:             Rewrite.             (line 234)
* case sensitive match, DeleteHeader:    Request Modification.
                                                              (line  95)
* case sensitive matching:               Rewrite.             (line 258)
* Cert:                                  ListenHTTPS.         (line  21)
* Cert <1>:                              Backend.             (line 131)
* challenge directory, ACME:             ACME.                (line  13)
* challenges, ACME:                      ACME.                (line   6)
* ChangeOwner:                           Management interface.
                                                              (line  31)
* CheckURL:                              Listener-specific limits.
                                                              (line  35)
* Ciphers:                               ListenHTTPS.         (line  70)
* Ciphers <1>:                           Backend.             (line 136)
* Client:                                Timeouts.            (line  17)
* Client <1>:                            Listener-specific limits.
                                                              (line   6)
* ClientCert:                            ListenHTTPS.         (line  43)
* ClientCert <1>:                        Service Selection Statements.
                                                              (line  56)
* ClientCert <2>:                        poundctl config.     (line  47)
* ClientCert <3>:                        multiple servers.    (line  35)
* clterr, log suppression:               Service Logging.     (line  45)
* CNAME chains:                          resolver.            (line  11)
* CNAMEChain:                            resolver.            (line  10)
* code of resp:                          Lua API.             (line 137)
* combined:                              Logging.             (line  96)
* combined, built-in format:             Logging.             (line 306)
* CombineHeaders:                        Proxy Tuning.        (line  80)
* comments, configuration file:          Lexical structure.   (line  12)
* comments, template:                    Actions.             (line  15)
* compound statement:                    Syntax.              (line  19)
* Condition:                             Detached Conditions. (line   6)
* condition:                             Service selection.   (line   6)
* Condition <1>:                         Condition.           (line   6)
* Condition <2>:                         Condition.           (line   6)
* conditional:                           Service selection.   (line   6)
* conditional, detached:                 Detached Conditions. (line   6)
* conditions, joining:                   Service selection.   (line 105)
* ConfigFile:                            resolver.            (line  20)
* ConfigText:                            resolver.            (line  24)
* conjunction, implicit:                 Service selection.   (line 105)
* conjunction, logical:                  Service selection.   (line 130)
* ConnTO:                                Timeouts.            (line  30)
* ConnTO <1>:                            Backend.             (line 113)
* Control:                               Service Control.     (line   6)
* Control <1>:                           Management interface.
                                                              (line  15)
* Control <2>:                           Special Backends.    (line  87)
* control socket:                        Management interface.
                                                              (line  11)
* cookie injection:                      Cookie injection.    (line   6)
* COOKIE, session type:                  Session.             (line  40)
* core:                                  poundctl commands.   (line   6)
* CPath:                                 Lua Settings.        (line  36)
* CRIT:                                  Lua API.             (line  40)
* CRLlist:                               ListenHTTPS.         (line 107)
* custom log format:                     Logging.             (line 103)
* Daemon:                                Runtime directives.  (line   6)
* DEBUG:                                 Lua API.             (line  25)
* Debug:                                 resolver.            (line  39)
* define:                                Actions.             (line  72)
* define <1>:                            Actions.             (line  76)
* delete:                                poundctl commands.   (line  35)
* DeleteHeader:                          Request Modification.
                                                              (line  69)
* DeleteHeader <1>:                      rewrite response.    (line  59)
* DeleteHeader <2>:                      Service Request and Response Modification.
                                                              (line  50)
* DeleteQuery:                           Request Modification.
                                                              (line  45)
* DeleteQuery <1>:                       Service Request and Response Modification.
                                                              (line  25)
* detached condition, evaluating:        Detached Conditions. (line  20)
* detached conditional:                  Detached Conditions. (line   6)
* detailed:                              Logging.             (line 100)
* detailed, built-in format:             Logging.             (line 310)
* directive:                             Syntax.              (line   9)
* Disable:                               ListenHTTPS.         (line  58)
* Disable <1>:                           Backend.             (line 142)
* disable:                               poundctl commands.   (line  27)
* disable <1>:                           poundctl commands.   (line  28)
* disable <2>:                           poundctl commands.   (line  29)
* Disabled:                              Backend.             (line  29)
* Disabled <1>:                          Other Statements.    (line   6)
* disjunction, logical:                  Service selection.   (line 122)
* div:                                   Pipelines.           (line 103)
* dns:                                   Usage.               (line 103)
* dot:                                   Template syntax.     (line   9)
* dump on pound:                         Lua API.             (line   9)
* dynamic backends:                      Dynamic backends.    (line   6)
* ECDHcurve:                             SSL Settings.        (line  10)
* else:                                  Actions.             (line  36)
* Emacs:                                 Emacs.               (line   6)
* EMERG:                                 Lua API.             (line  46)
* Emergency:                             Special Backends.    (line 115)
* enable:                                poundctl commands.   (line  19)
* enable <1>:                            poundctl commands.   (line  20)
* enable <2>:                            poundctl commands.   (line  21)
* eq:                                    Pipelines.           (line  53)
* ERR:                                   Lua API.             (line  37)
* err, syslog facility:                  Logging.             (line  19)
* Err400:                                Error definitions.   (line  18)
* Err401:                                Error definitions.   (line  18)
* Err403:                                Error definitions.   (line  18)
* Err404:                                Error definitions.   (line  18)
* Err413:                                Error definitions.   (line  18)
* Err414:                                Error definitions.   (line  18)
* Err500:                                Error definitions.   (line  18)
* Err501:                                Error definitions.   (line  18)
* Err503:                                Error definitions.   (line  18)
* Error:                                 Special Backends.    (line   9)
* ErrorFile:                             Error definitions.   (line  10)
* escape character:                      Lexical structure.   (line  30)
* eval:                                  Detached Conditions. (line  20)
* Eval:                                  Rewrite.             (line 100)
* Eval <1>:                              rewrite response.    (line  21)
* Eval <2>:                              Service Selection Statements.
                                                              (line  65)
* even:                                  Pipelines.           (line  73)
* exact match, DeleteHeader:             Request Modification.
                                                              (line  93)
* exact matching:                        Rewrite.             (line 243)
* exists:                                Pipelines.           (line  90)
* expansion, backreference:              Request modifications.
                                                              (line  40)
* extended:                              Logging.             (line  87)
* extended, built-in format:             Logging.             (line 298)
* facility, syslog:                      Logging.             (line   9)
* Family:                                Dynamic backends.    (line 102)
* Family <1>:                            Backend.             (line  52)
* file lookup:                           Rewrite.             (line 246)
* file monitoring:                       File-based Conditions.
                                                              (line   6)
* first:                                 Dynamic backends.    (line  84)
* forwarded:                             Proxy Tuning.        (line  40)
* ForwardedHeader:                       Logging configuration.
                                                              (line  41)
* ForwardedHeader <1>:                   Listener logging.    (line  21)
* ForwardedHeader <2>:                   Service Logging.     (line   6)
* Frank Schmirler:                       Overview.            (line  18)
* gcall on pound:                        Lua API.             (line  52)
* ge:                                    Pipelines.           (line  70)
* get:                                   cookie.lua.          (line   9)
* global lua loading:                    Lua.                 (line  22)
* Grace:                                 Timeouts.            (line  53)
* Group:                                 Runtime directives.  (line  17)
* gt:                                    Pipelines.           (line  67)
* header:                                Request Accessors.   (line  30)
* header <1>:                            jwt.lua.             (line  30)
* Header:                                Rewrite.             (line 106)
* Header <1>:                            Rewrite.             (line 107)
* Header <2>:                            rewrite response.    (line  27)
* Header <3>:                            Service Selection Statements.
                                                              (line  71)
* HEADER, session type:                  Session.             (line  44)
* HeaderAdd:                             Request Modification.
                                                              (line  59)
* HeaderAdd <1>:                         Service Request and Response Modification.
                                                              (line  40)
* HeaderOption:                          Proxy Tuning.        (line  33)
* HeaderRemove:                          Request Modification.
                                                              (line 116)
* HeaderRemove <1>:                      Service Request and Response Modification.
                                                              (line  51)
* headers of req:                        Lua API.             (line 120)
* headers of resp:                       Lua API.             (line 147)
* HeadRemove:                            Request Modification.
                                                              (line 117)
* HeadRemove <1>:                        Service Request and Response Modification.
                                                              (line  52)
* high availability:                     Balancer groups.     (line  16)
* Host:                                  Service selection.   (line  20)
* host:                                  Request Accessors.   (line  33)
* Host <1>:                              Rewrite.             (line 141)
* Host <2>:                              Service Selection Statements.
                                                              (line  77)
* HTTPS:                                 Backend.             (line 128)
* ID:                                    Session.             (line  48)
* if:                                    Actions.             (line  30)
* IgnoreCase:                            Regexp Settings.     (line  21)
* IgnoreCase <1>:                        Other Statements.    (line  27)
* IgnoreSRVWeight:                       Dynamic backends.    (line 123)
* IgnoreSRVWeight <1>:                   Backend.             (line  64)
* Include:                               File inclusion.      (line   6)
* include-dir=DIR:                       Usage.               (line 115)
* IncludeDir:                            File inclusion.      (line  16)
* index:                                 Pipelines.           (line  39)
* inet:                                  Dynamic backends.    (line 110)
* inet6:                                 Dynamic backends.    (line 113)
* INFO:                                  Lua API.             (line  28)
* info, log suppression:                 Service Logging.     (line  33)
* inotify:                               File-based Conditions.
                                                              (line  26)
* integer:                               Lua API.             (line  13)
* Interleaved weighted round robin balancing: Balancer.       (line  26)
* internal backend:                      Redirects.           (line   6)
* IP address:                            Lexical structure.   (line  55)
* IP, session type:                      Session.             (line  20)
* iwrr:                                  Balancer.            (line  73)
* keywords, configuration file:          Lexical structure.   (line  16)
* kqueue:                                File-based Conditions.
                                                              (line  26)
* le:                                    Pipelines.           (line  64)
* len:                                   Pipelines.           (line  47)
* LetsEncrypt:                           ACME.                (line   6)
* lexical structure of the configuration file: Lexical structure.
                                                              (line   6)
* line of req:                           Lua API.             (line  85)
* LineBufferSize:                        Runtime directives.  (line  49)
* LineBufferSize <1>:                    Listener-specific limits.
                                                              (line  14)
* list:                                  poundctl commands.   (line  11)
* list <1>:                              poundctl commands.   (line  12)
* list <2>:                              poundctl commands.   (line  13)
* list <3>:                              poundctl commands.   (line  14)
* listener:                              Introduction.        (line  29)
* ListenHTTP:                            ListenHTTP.          (line   6)
* ListenHTTPS:                           ListenHTTPS.         (line   6)
* Load:                                  Lua Settings.        (line  14)
* load balancing:                        Balancer.            (line   6)
* LoadGlobal:                            Lua Settings.        (line  19)
* log format, user-defined:              Logging.             (line 103)
* log on pound:                          Lua API.             (line  20)
* LogFacility:                           Logging.             (line   9)
* LogFacility <1>:                       Logging configuration.
                                                              (line   6)
* LogFacility <2>:                       Logging configuration.
                                                              (line   7)
* LogFormat:                             Logging.             (line 103)
* LogFormat <1>:                         Logging configuration.
                                                              (line  18)
* Logging:                               Logging.             (line   6)
* logical and:                           Service selection.   (line 130)
* logical and, explicit:                 Service selection.   (line 130)
* logical and, implicit:                 Service selection.   (line 105)
* logical conjunction, explicit:         Service selection.   (line 130)
* logical disjunction:                   Service selection.   (line 122)
* logical or:                            Service selection.   (line 122)
* LogLevel:                              Logging.             (line  19)
* LogLevel <1>:                          Logging configuration.
                                                              (line  24)
* LogLevel <2>:                          Logging configuration.
                                                              (line  25)
* LogLevel <3>:                          Listener logging.    (line   9)
* LogLevel <4>:                          Listener logging.    (line  10)
* LogSuppress:                           Service Logging.     (line  29)
* LogTag:                                Logging configuration.
                                                              (line  36)
* LOG_ERR:                               Logging.             (line  19)
* LOG_NOTICE:                            Logging.             (line  19)
* lt:                                    Pipelines.           (line  61)
* Lua:                                   Lua Settings.        (line   6)
* Lua <1>:                               Lua.                 (line   6)
* lua loading mode:                      Lua.                 (line  11)
* LuaBackend:                            Special Backends.    (line  24)
* LuaMatch:                              Rewrite.             (line 158)
* LuaMatch <1>:                          rewrite response.    (line  31)
* LuaMatch <2>:                          Service Selection Statements.
                                                              (line  94)
* LuaModify:                             LuaModify.           (line   6)
* LuaModify <1>:                         Request Modification.
                                                              (line  14)
* LuaModify <2>:                         rewrite response.    (line  65)
* LuaModify <3>:                         Service Request and Response Modification.
                                                              (line  63)
* major of version:                      Lua API.             (line 103)
* Match:                                 Service selection.   (line 122)
* Match <1>:                             Rewrite.             (line 299)
* Match <2>:                             Service Selection Statements.
                                                              (line 150)
* matching rule:                         Service selection.   (line   6)
* MaxRequest:                            Listener-specific limits.
                                                              (line  21)
* MaxURI:                                Listener-specific limits.
                                                              (line  27)
* method of req:                         Lua API.             (line  82)
* Metrics:                               Special Backends.    (line  91)
* minor of version:                      Lua API.             (line 106)
* Mode:                                  Management interface.
                                                              (line  28)
* mul:                                   Pipelines.           (line 100)
* multiple conditions:                   Service selection.   (line 105)
* mvh.inc:                               Proxy Tuning.        (line 104)
* ne:                                    Pipelines.           (line  57)
* new:                                   jwt.lua.             (line  13)
* no-forwarded:                          Proxy Tuning.        (line  70)
* no-include-dir:                        Usage.               (line 116)
* no-ssl:                                Proxy Tuning.        (line  70)
* NoHTTPS11:                             ListenHTTPS.         (line 111)
* Not:                                   Rewrite.             (line 293)
* Not <1>:                               Service Selection Statements.
                                                              (line 144)
* not:                                   Pipelines.           (line  50)
* NOTICE:                                Lua API.             (line  31)
* notice, syslog facility:               Logging.             (line  19)
* null:                                  Logging.             (line  78)
* null, built-in format:                 Logging.             (line 290)
* numbers, configuration file:           Lexical structure.   (line  23)
* O'Sullivan, Rick:                      Overview.            (line  18)
* off:                                   poundctl commands.   (line  30)
* off <1>:                               poundctl commands.   (line  31)
* off <2>:                               poundctl commands.   (line  32)
* on:                                    poundctl commands.   (line  22)
* on <1>:                                poundctl commands.   (line  23)
* on <2>:                                poundctl commands.   (line  24)
* or:                                    Pipelines.           (line  34)
* or, logical:                           Service selection.   (line 122)
* OverrideTTL:                           Backend.             (line  71)
* param:                                 Request Accessors.   (line  27)
* PARAM, session type:                   Session.             (line  35)
* parenthesized subexpression:           Request modifications.
                                                              (line  40)
* parse:                                 jwt.lua.             (line   9)
* path:                                  Request Accessors.   (line  21)
* Path:                                  Lua Settings.        (line  24)
* Path <1>:                              Rewrite.             (line 172)
* Path <2>:                              Service Selection Statements.
                                                              (line 108)
* path of req:                           Lua API.             (line  92)
* payload:                               jwt.lua.             (line  33)
* PCRE match, DeleteHeader:              Request Modification.
                                                              (line  97)
* PCRE match, DeleteHeader <1>:          Request Modification.
                                                              (line 100)
* PCRE match, headers:                   Rewrite.             (line 262)
* per-thread lua loading:                Lua.                 (line  18)
* Perl-compatible regular expression match, DeleteHeader: Request Modification.
                                                              (line  97)
* Perl-compatible regular expression match, DeleteHeader <1>: Request Modification.
                                                              (line 100)
* Perl-compatible regular expression match, headers: Rewrite. (line 262)
* Perl-compatible regular expressions:   Regular Expressions. (line   6)
* PIDFile:                               Runtime directives.  (line  21)
* pipeline:                              Actions.             (line  26)
* port:                                  Request Accessors.   (line  37)
* Port:                                  Listener address.    (line  15)
* Port <1>:                              Backend.             (line  38)
* posix regular expression match, DeleteHeader: Request Modification.
                                                              (line 102)
* posix regular expression matching:     Rewrite.             (line 266)
* POSIX regular expressions:             Service selection.   (line  31)
* pound-basic-offset:                    Emacs.               (line  56)
* pound-command:                         Emacs.               (line  63)
* pound-include-dir:                     Emacs.               (line  70)
* pound-mode.el:                         Emacs.               (line   6)
* pound.cfg:                             Introduction.        (line  13)
* poundctl.tmpl:                         poundctl template.   (line  13)
* POUNDCTL_CONF:                         poundctl config.     (line   6)
* pound_backends:                        Metric Families.     (line  81)
* pound_backend_requests:                Metric Families.     (line 150)
* pound_backend_request_stddev_nanoseconds: Metric Families.  (line 167)
* pound_backend_request_time_avg_nanoseconds: Metric Families.
                                                              (line 159)
* pound_backend_state:                   Metric Families.     (line 117)
* pound_listener_enabled:                Metric Families.     (line  38)
* pound_listener_info:                   Metric Families.     (line  46)
* pound_queue_len:                       Metric Families.     (line  35)
* pound_service_enabled:                 Metric Families.     (line  70)
* POUND_TMPL_PATH:                       poundctl template.   (line  31)
* pound_uptime:                          Metric Families.     (line   9)
* pound_workers:                         Metric Families.     (line  12)
* prefix match, DeleteHeader:            Request Modification.
                                                              (line  82)
* printf:                                Pipelines.           (line  77)
* Priority:                              Backend.             (line  42)
* priority, SRV record:                  Dynamic backends.    (line  25)
* query:                                 Request Accessors.   (line  24)
* Query:                                 Rewrite.             (line 176)
* Query <1>:                             Service Selection Statements.
                                                              (line 112)
* query of req:                          Lua API.             (line 109)
* QueryParam:                            Rewrite.             (line 184)
* QueryParam <1>:                        Service Selection Statements.
                                                              (line 120)
* quoted string:                         Lexical structure.   (line  30)
* random:                                Balancer.            (line  70)
* range:                                 Actions.             (line  54)
* rate-limiting:                         Rate-limiting.       (line   6)
* raw:                                   jwt.lua.             (line  39)
* reason of resp:                        Lua API.             (line 141)
* redirect:                              Redirects.           (line  11)
* Redirect:                              Special Backends.    (line  40)
* redirect, log suppression:             Service Logging.     (line  41)
* referring to previous conditionals:    Request modifications.
                                                              (line  70)
* referring to subexpressions:           Request modifications.
                                                              (line  70)
* RegexType:                             Regular Expressions. (line  11)
* RegexType <1>:                         Regexp Settings.     (line   6)
* regular:                               Logging.             (line  82)
* regular backend:                       Introduction.        (line  53)
* regular expression match, DeleteHeader: Request Modification.
                                                              (line 105)
* regular expression matching:           Rewrite.             (line 270)
* regular expressions, PCRE:             Regular Expressions. (line   6)
* regular expressions, Perl-compatible:  Regular Expressions. (line   6)
* regular expressions, POSIX:            Service selection.   (line  31)
* regular, built-in format:              Logging.             (line 294)
* remoteip:                              Request Accessors.   (line  42)
* req on http:                           Lua API.             (line  78)
* request accessor:                      Request modifications.
                                                              (line 102)
* request balancing:                     Balancer.            (line   6)
* request matching rule:                 Service selection.   (line   6)
* resolv.conf:                           resolver.            (line  21)
* Resolve:                               Dynamic backends.    (line  80)
* Resolve <1>:                           Backend.             (line  81)
* Resolver:                              resolver.            (line   6)
* resp of http:                          Lua API.             (line 132)
* RetryInterval:                         Dynamic backends.    (line 158)
* RetryInterval <1>:                     Backend.             (line 104)
* RetryInterval <2>:                     resolver.            (line  42)
* rewrite:                               Conditional branches.
                                                              (line   6)
* Rewrite:                               Rewrite.             (line   6)
* Rewrite <1>:                           Service Request and Response Modification.
                                                              (line  77)
* RewriteDestination:                    Request Modification.
                                                              (line  28)
* RewriteErrors:                         Error response rewriting.
                                                              (line  19)
* RewriteErrors <1>:                     Service Request and Response Modification.
                                                              (line  95)
* RewriteLocation:                       Response Modification.
                                                              (line   6)
* RFC 7617:                              Authentication.      (line   6)
* Rick O'Sullivan:                       Overview.            (line  18)
* Robert Segall:                         Overview.            (line  18)
* RootJail:                              Runtime directives.  (line  66)
* Schmirler, Frank:                      Overview.            (line  18)
* search path, templates:                poundctl template.   (line  13)
* section:                               Syntax.              (line  19)
* Segall, Robert:                        Overview.            (line  18)
* SendFile:                              Special Backends.    (line  61)
* Server, poundctl configuration:        multiple servers.    (line   6)
* ServerName:                            Backend.             (line 150)
* service:                               Introduction.        (line  35)
* Service definitions:                   Service definitions. (line   6)
* session:                               Sessions.            (line  18)
* Session:                               Session.             (line   6)
* set:                                   cookie.lua.          (line  13)
* SetHeader:                             Request Modification.
                                                              (line  58)
* SetHeader <1>:                         rewrite response.    (line  79)
* SetHeader <2>:                         Service Request and Response Modification.
                                                              (line  39)
* SetPath:                               Request Modification.
                                                              (line  35)
* SetPath <1>:                           Service Request and Response Modification.
                                                              (line  15)
* SetQuery:                              Request Modification.
                                                              (line  40)
* SetQuery <1>:                          Service Request and Response Modification.
                                                              (line  20)
* SetQueryParam:                         Request Modification.
                                                              (line  48)
* SetQueryParam <1>:                     Request Modification.
                                                              (line  49)
* SetQueryParam <2>:                     Service Request and Response Modification.
                                                              (line  28)
* SetURL:                                Request Modification.
                                                              (line  32)
* SetURL <1>:                            Service Request and Response Modification.
                                                              (line  12)
* sign on jwt:                           jwt.lua.             (line  19)
* signature:                             jwt.lua.             (line  36)
* simple statement:                      Syntax.              (line   9)
* Socket:                                Management interface.
                                                              (line  24)
* SocketFrom:                            Listener address.    (line  22)
* special backend:                       Redirects.           (line   6)
* srv:                                   Dynamic backends.    (line  94)
* SRV record, 0 weight:                  Dynamic backends.    (line  66)
* SRV record, DNS:                       Dynamic backends.    (line  25)
* SRV records, overriding weight:        Dynamic backends.    (line 123)
* srverr, log suppression:               Service Logging.     (line  49)
* ssl:                                   Proxy Tuning.        (line  44)
* SSLAllowClientRenegotiation:           ListenHTTPS.         (line  81)
* SSLEngine:                             SSL Settings.        (line   6)
* SSLHonorCipherOrder:                   ListenHTTPS.         (line  75)
* SSLv2:                                 ListenHTTPS.         (line  59)
* SSLv2 <1>:                             Backend.             (line 143)
* SSLv3:                                 ListenHTTPS.         (line  59)
* SSLv3 <1>:                             Backend.             (line 143)
* stash:                                 Lua API.             (line 162)
* stash <1>:                             Stash.               (line   6)
* statement, compound:                   Syntax.              (line  19)
* statement, simple:                     Syntax.              (line   9)
* strategy, request balancing:           Balancer.            (line  14)
* StringMatch:                           Rewrite.             (line 192)
* StringMatch <1>:                       rewrite response.    (line  45)
* StringMatch <2>:                       Service Selection Statements.
                                                              (line 128)
* sub:                                   Pipelines.           (line  97)
* substring match, DeleteHeader:         Request Modification.
                                                              (line  88)
* substring matching:                    Rewrite.             (line 237)
* success, log suppression:              Service Logging.     (line  37)
* suffix match, DeleteHeader:            Request Modification.
                                                              (line  91)
* suffix matching:                       Rewrite.             (line 240)
* Supervisor:                            Runtime directives.  (line  42)
* syntax, template:                      Template syntax.     (line   6)
* syslog facility:                       Logging.             (line   9)
* tagged statements:                     Request modifications.
                                                              (line  70)
* tagged statements <1>:                 Backreference Expansion.
                                                              (line  28)
* TBF:                                   Rate-limiting.       (line   6)
* TBF <1>:                               Rewrite.             (line 199)
* template:                              Actions.             (line  81)
* template search path:                  poundctl template.   (line  13)
* TemplateFile:                          poundctl config.     (line  55)
* TemplateName:                          poundctl config.     (line  61)
* TemplatePath:                          poundctl config.     (line  58)
* Threads:                               Worker Settings.     (line  18)
* tid on pound:                          Lua API.             (line  49)
* time formats:                          Time and Date Formats.
                                                              (line   6)
* TimeOut:                               Timeouts.            (line  24)
* TimeOut <1>:                           Backend.             (line 117)
* TLSv1:                                 ListenHTTPS.         (line  59)
* TLSv1 <1>:                             Backend.             (line 143)
* TLSv1_1:                               ListenHTTPS.         (line  59)
* TLSv1_1 <1>:                           Backend.             (line 143)
* TLSv1_2:                               ListenHTTPS.         (line  59)
* TLSv1_2 <1>:                           Backend.             (line 143)
* token bucket filter:                   Rate-limiting.       (line   6)
* TrustedIP:                             Logging configuration.
                                                              (line  47)
* TrustedIP <1>:                         Listener logging.    (line  27)
* TrustedIP <2>:                         Service Logging.     (line  12)
* TTL:                                   Session.             (line  53)
* Type:                                  Session.             (line  16)
* typeof:                                Pipelines.           (line  86)
* url:                                   Request Accessors.   (line  18)
* URL:                                   Rewrite.             (line 222)
* URL <1>:                               Service Selection Statements.
                                                              (line 135)
* URL <2>:                               poundctl config.     (line  35)
* URL <3>:                               multiple servers.    (line  24)
* url of req:                            Lua API.             (line  89)
* URL, session type:                     Session.             (line  30)
* UseBackend:                            UseBackend.          (line  17)
* User:                                  Runtime directives.  (line  78)
* user database:                         Authentication.      (line  23)
* values, configuration file:            Lexical structure.   (line  20)
* Verify:                                poundctl config.     (line  51)
* Verify <1>:                            multiple servers.    (line  39)
* verify on jwt:                         jwt.lua.             (line  23)
* VerifyList:                            ListenHTTPS.         (line  97)
* version of req:                        Lua API.             (line  95)
* vhost_combined:                        Logging.             (line  92)
* vhost_combined, built-in format:       Logging.             (line 302)
* warn-deprecated:                       Usage.               (line  98)
* WARNING:                               Lua API.             (line  34)
* WatcherTTL:                            File-based Conditions.
                                                              (line  32)
* WatcherTTL <1>:                        Timeouts.            (line  37)
* weight override, SRV records:          Dynamic backends.    (line 123)
* weight, SRV record:                    Dynamic backends.    (line  25)
* Weighted random balancing:             Balancer.            (line  18)
* with:                                  Actions.             (line  96)
* WorkerIdleTimeout:                     Worker model.        (line  21)
* WorkerIdleTimeout <1>:                 Worker Settings.     (line  14)
* WorkerMaxCount:                        Worker model.        (line  13)
* WorkerMaxCount <1>:                    Worker Settings.     (line  10)
* WorkerMinCount:                        Worker model.        (line   6)
* WorkerMinCount <1>:                    Worker Settings.     (line   6)
* WSTimeOut:                             Timeouts.            (line  46)
* WSTimeOut <1>:                         Backend.             (line 121)
* xHTTP:                                 Listener-specific limits.
                                                              (line  40)



Tag Table:
Node: Top705
Node: Overview3874
Ref: Overview-Footnote-15585
Node: Introduction5656
Ref: objects6883
Ref: service intro7318
Ref: Introduction-Footnote-19648
Node: Usage9757
Ref: lint10323
Ref: dns13842
Node: Simple Proxy15230
Ref: Simple Proxy-Footnote-116699
Node: Service selection16824
Ref: Match in service statement20641
Node: Regular Expressions21568
Node: File-based Conditions22569
Ref: File-based Conditions-Footnote-124873
Ref: File-based Conditions-Footnote-224939
Node: ACL25009
Ref: File reference ACL26273
Ref: ACL filewatch26950
Ref: ACL reference27124
Node: Detached Conditions28756
Node: Request modifications31692
Ref: parenthesized subexpression32528
Node: Conditional branches35140
Node: Modifying responses36418
Node: Authentication37520
Node: Rate-limiting40877
Node: Redirects44404
Node: Error responses46406
Node: HTTPS48212
Node: ACME50476
Ref: ACME-Footnote-152174
Node: Redirect HTTP to HTTPS52248
Node: HTTPS backends53057
Node: Balancer54370
Node: Sessions57270
Node: Balancer groups60128
Node: Dynamic backends61314
Ref: Dynamic backends-Footnote-168317
Ref: Dynamic backends-Footnote-268534
Ref: Dynamic backends-Footnote-368663
Node: Worker model69038
Node: Lua70297
Ref: global lua loading71340
Ref: Lua-Footnote-172287
Node: LuaLoad72371
Node: LuaMatch74448
Node: LuaModify77734
Node: Cookie injection78865
Node: Stash81703
Node: LuaBackend84003
Node: Lua API86177
Ref: gcall87474
Ref: lua-http88410
Ref: http.req.headers89737
Ref: http.resp.code90509
Ref: http.resp.body91336
Node: Logging92153
Ref: log format95374
Ref: %a96277
Ref: Logging-Footnote-1102421
Node: Configuration102491
Node: Lexical structure103010
Ref: Strings104107
Node: Syntax104989
Node: String Expansions105990
Node: Backreference Expansion106629
Node: Request Accessors108591
Node: Global directives110059
Node: Runtime directives110568
Ref: Daemon110750
Ref: PIDFile111337
Ref: line buffer112536
Ref: Runtime directives-Footnote-1114048
Node: Worker Settings114121
Node: Proxy Tuning114927
Ref: BackendStats115140
Node: SSL Settings118706
Node: Regexp Settings119123
Node: ACL definition120503
Node: Condition121988
Node: Lua Settings122727
Node: File inclusion124209
Ref: include directory124853
Node: Logging configuration125745
Node: Management interface128497
Ref: Control statement129163
Node: Service Control130185
Node: Timeouts131868
Node: ListenHTTP134190
Node: Listener address135067
Node: Listener-specific limits136116
Node: Error definitions138447
Node: Listener logging141501
Node: Request Modification142722
Ref: deleteheader-option146071
Node: Rewrite147969
Ref: request matching directives149076
Ref: conditionals149076
Ref: Eval statement152301
Ref: conditional-option157570
Ref: -file157958
Ref: tag159034
Node: Response Modification160957
Node: rewrite response162465
Node: Error response rewriting165889
Node: Service definitions167014
Node: ListenHTTPS167964
Ref: ClientCert169545
Node: Service172701
Node: Service Selection Statements174291
Ref: ClientCert conditional176845
Node: Service Request and Response Modification181147
Node: Service Logging185290
Ref: LogSuppress186355
Node: Backends187059
Node: Backend187243
Ref: ServerName192815
Node: UseBackend193088
Node: Special Backends194247
Ref: Error backend194516
Ref: SendFile196714
Ref: Metrics198005
Ref: Emergency198697
Node: Session199114
Node: Other Statements201237
Node: resolver202562
Node: poundctl204232
Node: poundctl commands206722
Ref: poundctl list207119
Node: poundctl remote207895
Node: poundctl config209184
Node: multiple servers211980
Node: poundctl options213419
Node: poundctl template215237
Ref: poundctl template-Footnote-1217495
Node: Template syntax217601
Ref: Template syntax-Footnote-1219046
Node: Actions219089
Node: Arguments222712
Node: Pipelines223400
Node: Variables226882
Node: Input object227779
Node: Core listing228555
Node: Full listing229624
Node: Listener object230188
Node: Service object231132
Node: Backend object232252
Node: Emacs233867
Ref: pound-mode233993
Node: Metric Families236633
Node: Time and Date Formats243280
Ref: %c time format244251
Ref: %s time format247239
Ref: conversion specs249379
Node: Old Control Format250045
Node: Example Lua modules251803
Node: jwt.lua252108
Node: cookie.lua258039
Node: GNU Free Documentation License260093
Node: Index285247

End Tag Table


Local Variables:
coding: utf-8
End:
