Add in examples
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/8ba691cf Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/8ba691cf Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/8ba691cf Branch: refs/heads/master Commit: 8ba691cfa01b0ce62af419d65e8a6d919de471f2 Parents: 9e0e5f3 Author: Miles Libbey <[email protected]> Authored: Wed Dec 4 16:01:04 2013 -0800 Committer: Miles Libbey <[email protected]> Committed: Wed Dec 4 16:01:04 2013 -0800 ---------------------------------------------------------------------- doc/reference/plugins/cacheurl.en.rst | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/8ba691cf/doc/reference/plugins/cacheurl.en.rst ---------------------------------------------------------------------- diff --git a/doc/reference/plugins/cacheurl.en.rst b/doc/reference/plugins/cacheurl.en.rst index 093beac..5ae7b12 100644 --- a/doc/reference/plugins/cacheurl.en.rst +++ b/doc/reference/plugins/cacheurl.en.rst @@ -21,7 +21,7 @@ CacheURL Plugin This plugin allows you to change the key that is used for caching a -request. It is designed so that multiple requests that have different +request by using any portion of the url via regex. It is designed so that multiple requests that have different URLs but the same content (for example, site mirrors) need be cached only once. @@ -38,22 +38,40 @@ Configuration ============= Create a ``cacheurl.config`` file in the plugin directory with the url -patterns to match. See the ``cacheurl.config.example`` file for what to -put in this file. +regex patterns to match. + +``url_pattern cache_key_replacement`` + + +The url_pattern is a regular expression (pcre). The replacement can contain $1, $2 and so on, which will be replaced with the appropriate matching group from the pattern. Add the plugin to your -```plugins.config`` <../../configuration-files/plugins.config>`_ file:: +`plugins.config <../../configuration-files/plugins.config>`_ file:: cacheurl.so Start traffic server. Any rewritten URLs will be written to ``cacheurl.log`` in the log directory by default. +Examples +======== +1. To make files from s1.example.com, s2.example.com and s3.example.com all be cached with the same key. Adding a unique suffix (TSINTERNAL in this example) to the cache key guarantees that it won't clash with a real URL should s.example.com exist. + + ``http://s[123].example.com/(.*) http://s.example.com.TSINTERNAL/$1`` + +2. Cache based on only some parts of a query string (e.g. ignore session information). This plucks out the id and format query string variables and only considers those when making the cache key. + + ``http://www.example.com/video\?.*?\&?(id=[0-9a-f]*).*?\&(format=[a-z]*) http://video-srv.example.com.ATSINTERNAL/$1&$2`` + +3. Completely ignore a query string for a specific page + + ``http://www.example.com/some/page.html(?:\?|$) http://www.example.com/some/page.html`` + More docs ============= There are some docs on cacheurl in Chinese, please find them in the following: -```http://people.apache.org/~zym/trafficserver/cacheurl.html`` <http://people.apache.org/~zym/trafficserver/cacheurl.html>`_ +.. http://people.apache.org/~zym/trafficserver/cacheurl.html`` <http://people.apache.org/~zym/trafficserver/cacheurl.html>`_ -```https://blog.zymlinux.net/index.php/archives/195`` <https://blog.zymlinux.net/index.php/archives/195>`_ +https://blog.zymlinux.net/index.php/archives/195
