You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/08/21 19:00:08 UTC

[2/3] git commit: TS-1597: Document remap.config filters

TS-1597: Document remap.config filters

Add documentation and examples for the
.definefilter, .activatefilter, and .deactivatefilter
directives in remap.config.

These docs are specifically restricted to these particular names
because (1) we should standardize on one variant for each of these
directives to avoid end-user confusion and (2) I personally believe
these variants to be the clearest and most understandable ("defflt",
"useflt", "deuseflt", etc., are confusing or awkward).

The .deletefilter directive is not documented, because I am not sure
when or why it would be used.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8975eec7
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8975eec7
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8975eec7

Branch: refs/heads/4.0.x
Commit: 8975eec745cfe1b8358a6f1c71e9919725990ff5
Parents: bd8d18b
Author: Jim Riggs <ji...@riggs.me>
Authored: Wed Aug 7 21:24:38 2013 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Wed Aug 21 10:51:51 2013 -0600

----------------------------------------------------------------------
 CHANGES                                         |  4 +++
 doc/reference/configuration/remap.config.en.rst | 33 ++++++++++++++++++
 proxy/config/remap.config.default               | 36 ++++++++++++++------
 3 files changed, 63 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8975eec7/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 35f799e..84bffe3 100644
--- a/CHANGES
+++ b/CHANGES
@@ -28,8 +28,12 @@ Changes with Apache Traffic Server 4.0.0
    v1.33, which is what RHEL5 ships with.
 
 
+  *) [TS-1597] Document remap.config filters
+    Author: Jim Riggs <ji...@riggs.me>
+
 Changes with Apache Traffic Server 3.3.5
 
+
   *) [TS-2051] Fix SSL crash due to excess READ_COMPLETE events.
 
   *) [TS-2099] Using wrong member when setting active timeout.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8975eec7/doc/reference/configuration/remap.config.en.rst
----------------------------------------------------------------------
diff --git a/doc/reference/configuration/remap.config.en.rst b/doc/reference/configuration/remap.config.en.rst
index 5122e60..188f32b 100644
--- a/doc/reference/configuration/remap.config.en.rst
+++ b/doc/reference/configuration/remap.config.en.rst
@@ -275,3 +275,36 @@ Examples
 will pass "1" and "2" to plugin1.so and "3" to plugin2.so.
 
 This will pass "1" and "2" to plugin1.so and "3" to plugin2.so
+
+Named Filters
+=============
+
+Named filters can be created and applied to blocks of mappings using
+the ``.definefilter``, ``.activatefilter``, and ``.deactivatefilter``
+directives. Named filters must be defined using ``.definefilter`` before
+being used. Once defined, ``.activatefilter`` can used to activate a
+filter for all mappings that follow until deactivated with
+``.deactivatefilter``.
+
+Examples
+--------
+
+::
+
+    .definefilter disable_delete_purge @action=deny @method=delete @method=purge
+    .definefilter internal_only @action=allow @src_ip=192.168.0.1-192.168.0.254 @src_ip=10.0.0.1-10.0.0.254
+
+    .activatefilter disable_delete_purge
+
+    map http://foo.example.com/ http://bar.example.com/
+
+    .activatefilter internal_only
+    map http://www.example.com/admin http://internal.example.com/admin
+    .deactivatefilter internal_only
+
+    map http://www.example.com/ http://internal.example.com/
+
+The filter `disable_delete_purge` will be applied to all of the
+mapping rules. (It is activated before any mappings and is never
+deactivated.) The filter `internal_only` will only be applied to the
+second mapping.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8975eec7/proxy/config/remap.config.default
----------------------------------------------------------------------
diff --git a/proxy/config/remap.config.default b/proxy/config/remap.config.default
index 91b8cbb..e0cd89a 100644
--- a/proxy/config/remap.config.default
+++ b/proxy/config/remap.config.default
@@ -1,5 +1,5 @@
 #
-#  URL Remapping Config File 
+#  URL Remapping Config File
 #
 # Using remap.config allows you to accomplish two things:
 #
@@ -13,11 +13,11 @@
 #
 # Be aware, doing so makes the proxy a generic, open-relay!
 #
-#  The format is: 
+#  The format is:
 #      <map_type> client-URL origin-server-URL <tag_value> <filtering>
 #
 # Where client-URL and origin-server-URL are both of the format
-#    <scheme>://<host>:<port>/<path_prefix> 
+#    <scheme>://<host>:<port>/<path_prefix>
 #
 #  The <tag_value> directive is optional and can be different for different
 #  types of <map_type>. The <filtering arguments> are optional ACL-like
@@ -120,12 +120,12 @@
 #  all referers are allowed.  Various combinations of "*" and "~" in a referer
 #  list can be used to create different filtering rules.
 #
-#  Examples: 
+#  Examples:
 #    map_with_referer http://y.foo.bar.com/x/yy/  http://foo.bar.com/x/yy/ http://games.bar.com/new_games .*\.bar\.com www.bar-friends.com
 #
 #  Explanation: Referer header must be in the request, only ".*\.bar\.com"
 #  and "www.bar-friends.com" are allowed.
-#  
+#
 #    map_with_referer http://y.foo.bar.com/x/yy/  http://foo.bar.com/x/yy/ http://games.bar.com/new_games * ~.*\.evil\.com
 #
 #  Explanation: Referer header must be in the request but all referers are
@@ -150,11 +150,27 @@
 #    map http://foo.cow.com/ http://bar.cow.com @src_ip=10.72.118.51-10.72.118.62 @method=GET @method=DELETE @src_ip=192.168.0.1-192.168.0.254 @action=allow @method=PUT
 #
 #
-# ToDo: This has to be documented.
-# .defflt  disable_all @action=deny @src_ip=0.0.0.1-254.254.254.254
-# .defflt  disable_delete_purge @action=deny @method=delete @method=purge
-# .useflt  disable_all
-# .useflt  disable_delete_purge
+#  Named filters can be created and applied to blocks of mappings
+#  using the .definefilter, .activatefilter, and .deactivatefilter
+#  directives. Named filters must be defined using .definefilter
+#  before being used. Once defined, .activatefilter can used to
+#  activate a filter for all mappings that follow until deactivated
+#  with .deactivatefilter.
+#
+#  Example:
+#    .definefilter disable_delete_purge @action=deny @method=delete @method=purge
+#    .definefilter internal_only @action=allow @src_ip=192.168.0.1-192.168.0.254 @src_ip=10.0.0.1-10.0.0.254
+#
+#    .activatefilter disable_delete_purge
+#
+#    map http://foo.example.com/ http://bar.example.com/
+#
+#    .activatefilter internal_only
+#    map http://www.example.com/admin http://internal.example.com/admin
+#    .deactivatefilter internal_only
+#
+#    map http://www.example.com/ http://internal.example.com/
+#
 #
 #  Regex support: Regular expressions can be specified in the rules with the
 #  following limitations: