The Client tag enables you to limit the execution of a set of directives to requests received from specific clients. Directives listed within the Client tag are executed only when information in the client request matches the parameter values specified.
The following table lists the Client tag parameters.
Table 6–1 Client Tag Parameters
Parameter |
Description |
---|---|
browser |
The User-Agent string sent by a browser to the Web Server. |
chunked |
A Boolean value set by a client requesting chunked encoding. |
code |
The HTTP response code. |
dns |
The DNS name of the client. |
internal |
The Boolean value indicating internally generated request. |
ip |
The IP address of the client. |
keep-alive |
The Boolean value indicating whether the client has requested a keep-alive connection. |
keysize |
The key size used in an SSL transaction. |
match |
The match mode for the Client tag. The valid values are all, any, and none. |
method |
The HTTP method used by the browser. |
name |
The name of an object as specified in a previous NameTrans statement. |
odds |
A random value for evaluating the enclosed directive. The value can be a percentage or a ratio (for example, 20% or 1/5). |
path |
The physical path to the requested resource. |
ppath |
The physical path of the requested resource. |
query |
The query string sent in the request. |
reason |
The text version of the HTTP response code. |
restarted |
A Boolean value indicating that a request has been restarted. |
secret-keysize |
The secret key size used in an SSL transaction. |
security |
Indicates an encrypted request. |
type |
The type of document requested (such as text/html or image/gif). |
uri |
The URI section of the request from the browser. |
urlhost |
The DNS name of the virtual server requested by the client (the value is provided in the Host header of the client request). |
The Client tag parameter provides greater control when the If directive is executed. In the following example, use of the odds parameter gives the request a 25% chance of being redirected:
<Client odds="25%"> NameTrans fn="redirect" from="/Pogues" url-prefix="http://pogues.example.com" </Client>
One or more wildcard patterns can be used to specify the Client tag parameter values. Wildcards can also be used to exclude clients that match the parameter value specified in the Client tag. In the following example, the Client tag and the AddLog directive are combined to direct the Web Server to log access requests from all clients except those from the specified subnet:
<Client ip="*~192.85.250.*"> AddLog fn="flex-log" name="access" </Client>
You can also create a negative match by setting the match parameter of the Client tag to none. In the following example, access requests from the specified subnet are excluded as are all requests to the virtual server sun.com:
<Client match="none" ip="192.85.250.*" urlhost="www.sun.com"> AddLog fn="flex-log" name="access" </Client>
For more information about wildcard patterns, see Appendix B, Using Wildcard Patterns.