Prev: Next: , Up: Service[Contents][Index]


9.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 (see 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 "value"

Set the path part of the URL to the given string.

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: SetQueryParam "name" "value"

Set the query parameter name to the value. The value must be properly encoded if it contains reserved characters.

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 Table 9.1.

Service statement: Rewrite [ request | response ] ... End

This block statement associates one or more header modification directives discussed above with request matching directives, 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.

See Rewrite, for a detailed discussion of this statement.

See Conditional branches, for an in-depth discussion with examples.

See Modifying responses, for a discussion of the use of this statement to modify responses.


Prev: Next: , Up: Service[Contents][Index]