Menu

Location Table

Ray

Location Table

The location table is a simple file of key-value pairs. The file is used to determine the target URL to which the client should be redirected. When the client specifieds the Host header within the HTTP request (which is mandatory starting HTTP/1.1 up), the value specified in the header takes precedence over the authority specified in the request URL.
When the Host header is missing (HTTP/1.0 and below), redird extracts the authority part (host:port) from the request URI, adding the port 80 if omitted.
In any case, the resulting host:port key is sought in the location table file and if a match is found, the corresponding value of the pair is used as the base of the target URL.
If none of the above yields a valid host:port value, the default redirection (see option -s) is used, if configured. If it is not configured, a HTTP 404 Not Found response is sent to the client.

The location table has a simple syntax specifying one redirection per line:

host:port LWSP+ URL

LWSP is either a space or a tab and there must be at least one. Empty lines and lines starting with a hashmark are ignored.
Note the comparison is case-insensitive, but does NOT incorporate any DNS (or other naming services) search. Thus if you know that your servers can be referenced both by bare hostnames and FQDNs, then you MUST specify two redirection lines for each, e.g.

myweb.example.com:80  http://intranet.example.com/myweb
myweb:80              http://intranet.example.com/myweb

Related

Wiki: Command Line Options