Prev: Next: Up: Response Modification[Contents][Index]


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_directivesmodification_directives…
[ Else
    conditional_directivesmodification_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. See 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 Request modifications.

This statement is available only if pound was built with Lua support. See Lua conditionals, for a detailed discussion.

Rewrite response conditional: StringMatch "string" [options] "pattern"

Expands string as described in String Expansions, and matches the resulting value against pattern.

See 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. See 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. See Table 10.1, 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 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.

Response modification: SetHeader "name: value"

Sets the HTTP response header. Argument undergoes string expansion (See 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.


Prev: Next: Up: Response Modification[Contents][Index]