Prev: Next: Up: ListenHTTP[Contents][Index]


11.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 (see 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 Request modifications.

This statement is available only if pound was built with Lua support. See Changing requests and responses in Lua, 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:

FlagMeaning
-begExact match at the beginning of string (prefix match).
-caseCase-sensitive comparison.
-containDelete each header where "pattern" is a substring.
-endExact match at the end of string (suffix match).
-exactUse exact string match.
-icaseCase-insensitive comparison.
-pcreUse Perl-compatible regular expression. see Regular Expressions.
-perlSame as -pcre.
-posixUse POSIX extended regular expression. see Regular Expressions.
-reUse regular expression match. This assumes the default regular expression type, as set by the RegexType directive (see Regular Expressions).

Table 11.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"

Prev: Next: Up: ListenHTTP[Contents][Index]