|
||||
Redirection Primer1 URL PrimerIf you are a rookie in HTTP/URL stay tuned. Others may skip this section.1.1 Antonomy of an URLA HTTP URL is splitted into the following parts (Actually this not quite complete, I know. But this is a primer. If you want to get more information, please consult the IETF RFCs)
http://my.server.com/path0/path1/path2?foo=bar&bar=foo#here `---´ `-----------´ `---------------´ `-------------´ `--´ | | | | | scheme authority path query fragment 1.2 Path and SegmentsThe path part of an URL may be splitted into segments. Each segment is addressed by its position in the path starting with '0':seg-0/seg-1/seg-2/seg-3/seg-4 `---------------´ | e.g. segment offset 1, length 3 1.3 Query and ParameterThe query part of an URL may be seen as dictionary (key, value) tuples. Each key defines a parameter with a given value.foo=bar&bar=foo&baux=ixi `-----´ `-----´ `------´ | e.g. have a parameter 'bar' with value 'foo' 2 Looky RedirectorThe Looky balancer clients CGI and Squid are using the 's Redirectory algo described in this section. It is necessary for you to understand this section if you want to use Looky in your organization.The Looky Redirector algo is a simple URL translation. The URL sent by the consumer is taken as input. The algo computes a redirected URL and returns this URL as output. The algo consists of three steps:
2.1 Extract Pool and ConsumerThe pool and the consumer are computed by so called compute-pool / compute-consumer expressions. This 'compute' expressions are functions, that use either the path, the query, the environment or a constant string as input to compute the pool/consumer.
2.2 Compute Redirect URLIf a resource has been assigned to the consumer, a redirect pattern is evaluated. This redirect pattern is fitted with ctags. The ctags are very powerfull shell like tags with the following features:
The ctag %{path} and %{query} are filled with so called transient expressions. A transient expression computes those parts of the path/query that are transient for the algo, from the original URL (send by consumer) to the redirect URL (send to consumer). 2.3 Examples2.3.1 Example 1Settings:
Recommended redirection rules: redirect:http://%{resource}/%{path}%{url/query:?%{url/query}}%{url/fra\ \gment:#%{url/fragment}} compute.pool:path/0 compute.consumer:const/- transient.path:1 Due to the need to support several pools, the pool is read from segment 0 of the original URL send by consumer (e.g. /sales/start/my/appl?time=now). As a consequence from this, this pools prefix is cut off in transient %{path}. This setting implies that the locations '/admin/' and '/sales/' on Apache WEB server are run by looky balancer client CGI. However with this approach you are able to assign individual ACL for both locations. If you have no need to distinquish consumers, the constant expression '-' must be used. The orignal query and fragment part are passed thru (if they are used). 2.3.2 Example 2Settings:
Recommended redirection rules: redirect:http://%{resource}/%{url/path}%{url/query:?%{url/query}}%{url\ \/fragment:#%{url/fragment}} compute.pool:const/pool compute.consumer:env/REMOTE_ADDR We just have one pool here, so a const expression to select the pool is the best. Environment variable REMOTE_ADDR is used to identify the consumer. The original URL parts are more or less passed through. |