TS-2316: header_rewrite: improved documentation Added variable expansion, counter operation and cookie condition. Removed non-existient METHOD condition example.
Submitted by: Alexey Ivanov <[email protected]> Sponsored by: LinkedIn Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c83a5293 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c83a5293 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c83a5293 Branch: refs/heads/5.0.x Commit: c83a52937791827a949d4b8469c7a4439860f6bb Parents: 3d37f51 Author: Alexey Ivanov <[email protected]> Authored: Sun Nov 10 18:23:39 2013 -0800 Committer: Alexey Ivanov <[email protected]> Committed: Sun Nov 10 18:23:39 2013 -0800 ---------------------------------------------------------------------- plugins/header_rewrite/README | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c83a5293/plugins/header_rewrite/README ---------------------------------------------------------------------- diff --git a/plugins/header_rewrite/README b/plugins/header_rewrite/README index f90d62a..fba6693 100644 --- a/plugins/header_rewrite/README +++ b/plugins/header_rewrite/README @@ -4,9 +4,6 @@ perform various header "rewrite" rules (operations) on a request or response. Currently, only one operation is supported, since we had to get this rolling asap. -Note that currently only static string "values" are supported. We'll add -advanced features to allow for expansions in a future release. - Using the plugin ---------------- @@ -36,6 +33,7 @@ The following operators are available: set-status-reason <value> [flags] set-config config <value> [flags] no-op [flags] + counter counter-name [flags] The following operator(s) currently only works when instantiating the plugin as a remap plugin: @@ -60,6 +58,18 @@ Operator flags [L] Last rule, do not continue +Variable expansion +------------------ +Currntly only limited variable expansion is supported in add-header. Supported +substitutions include: + %<proto> Protocol + %<port> Port + %<chi> Client IP + %<cqhl> Client request length + %<cqhm> Client HTTP method + %<cquup> Client unmapped URI + + Conditions ---------- The conditions are used as qualifiers: The operators specified will @@ -71,8 +81,8 @@ only be evaluated if the condition(s) are met. cond %{TRUE} [flags] cond %{FALSE} [flags] cond %{HEADER:header-name} operand [flags] + cond %{COOKIE:cookie-name} operand [flags] cond %{CLIENT-HEADER:header-name} operand [flags] - cond %{METHOD} operand [flags] cond %{PROTOCOL} operand [flags] cond %{PORT} operand [flags] cond %{HOST} operand [flags] @@ -103,7 +113,7 @@ configuration, but being the default it is also optional. Condition flags --------------- - [NC] Not ase sensitive condition (when applicable) + [NC] Not case sensitive condition (when applicable) [AND] AND with next condition (default) [OR] OR with next condition [NOT] Invert this condition @@ -133,11 +143,12 @@ Examples -------- cond %{HEADER:X-Y-Foobar} -cond %{METHOD} =GET [OR] -cond %{METHOD} =POST +cond %{COOKIE:X-DC} =DC1 add-header X-Y-Fiefum %{HEADER:X-Y-Foobar} +add-header X-Forwarded-For %<chi> rm-header X-Y-Foobar rm-header Set-Cookie +counter plugin.header_rewrite.x-y-foobar-dc1 cond %{HEADER:X-Y-Foobar} "Some string" [AND,NC]
