iTP Secure WebServer System Administrators Guide (Version 7.5+)

}
}
In this example, the Region directive limits access to the /pictures area. Any users attempting
to access this area between 7AM and 7PM (local server time) will be directed to the
/come-back-later.html document.
Example 2: REMOTE_HOST and REMOTE_ADDR Variables
You can use the REMOTE_HOST and REMOTE_ADDR variable (containing the host name of the
Web client making a request) or the REMOTE_ADDR variable (containing the IP address of the
Web client) with the Tcl switch command:
Region / {
switch $REMOTE_HOST {
*.mit.edu {Redirect /mit/home.html}
*.cornell.edu {Redirect /cornell/home.html}
*.yale.edu {Redirect /yale/home.html}
*.wvu.edu {Redirect /wvu/home.html}
}
}
In this example, the switch command directs requests to different home pages on the basis of
the origin of each request.
Example 3: HEADER Variable
The HEADER array variable contains any HTTP headers sent by a Web client, including the headers
containing the Web client software type and the referring URL. The indexes of the array elements
consist of the header names, converted to lowercase, with no trailing colon. For example, the HTTP
header
User-Agent:
would be stored as array element
HEADER(user-agent)
Because clients do not have to send headers, Region commands using the HEADER variable
should first check for the existence of a HEADER array entry, by using the Tcl info
existscommand.
For example, assume the Dinosaur/1.0 browser fails whenever it attempts to use a particular
CGI program and you want to direct all Dinosaur/1.0 users to an alternative page. In this case,
you could use the User-Agent header to issue a redirect:
Region /order.cgi {
if {[info exists HEADER(user-agent)] && \
[string match "*Dinosaur/1.0" $HEADER(user-agent)]} {
Redirect /order-dinosaur.cgi
}
}
Allowing Byte Ranges
The iTP Secure WebServer supports byte-range access, which is always enabled. Web clients that
also support byte-range access can request any range within a requested file. For detailed
information about byte ranges, see RFC 2068 "Hypertext Transfer Protocol-HTTP/1.1," section
14.36; you can see RFC 2068 by using this URL:
http://www.ietf.org/rfc/rfc2068.txt
In practice, most data on the Web is represented as a byte stream and can be addressed with a
byte range to retrieve a desired portion of it. This is useful when, for example, a document
transmitted is interrupted, and then resumed: only the missing portion needs to be transferred.
Byte-range requests are typically generated by the Web client's software.
122 Configuring the iTP Secure WebServer