Translating URLs

How the filer responds to URLs

You can specify that the filer's response to an HTTP request be dependent on the URL. For example, you can configure the filer to redirect a particular request to a specific directory, or to prevent access to a particular directory that is specified in the URL.

How the filer maps its responses to URLs is defined in a configuration file named /etc/httpd.translations. Each entry in the configuration file contains up to three fields in the following format:

rule template result 
Field Description
rule
Defines the response of the filer to a request.
template
Specifies a component of a URL.
result
Depends on the rule, as described in the following section.

Translation rules supported by the filer

This section explains the meanings of the rules. It also describes the format required for each type of entry in /etc/httpd.translations.

The map rule

The map rule specifies that if a component of a URL matches the template, the request is mapped to another directory on the same host as defined in the result field.

For example, the following /etc/httpd.translations entry causes any requests to a URL containing the /image-bin directory to be mapped to the /usr/local/http/images directory:

map /image-bin/* /usr/local/http/images/* 
The redirect rule

The redirect rule specifies that if a component of a URL matches the template, the request is redirected to the URL defined in the result field. The result field for the redirect rule must be specified as a complete URL beginning with http:// and the host name.

For example, if /etc/httpd.translations contains the following entry

redirect /cgi-bin/* http://cgi-host/*

the filer redirects CGI requests to another HTTP server named cgi-host. This is essential for calls to cgi-bin because the filer does not execute them.

The pass rule

The pass rule specifies that if a component of a URL matches the template, the filer accepts the request, processes the request as is, and disregards other rules.

For example, if /etc/httpd.translations contains the following entry

pass /image-bin/*

the filer processes the request for any URL containing /image-bin as is, even though there is another rule specified as follows:

map /image-bin/* /usr/local/http/images/* 

If the pass rule includes the result field, the filer accepts the request, processes the request by using the URL defined in the result field, and disregards other rules.

The fail rule

The fail rule specifies that if a component of a URL matches the template, the filer denies access to that component and disregards other rules.

For example, if /etc/httpd.translations contains the following entry

fail /usr/forbidden/* 

the filer does not provide access to the /usr/forbidden directory.

How the filer processes rules

The filer processes the rules defined in /etc/httpd.translations in the order they are listed, and applies the rule if the URL matches the template. However, the filer stops processing other rules after it applies a pass or fail rule.

In the template or result field of an /etc/httpd.translations entry, you can use asterisks (*) as wildcard characters, as follows:

Following is an example showing how a wildcard character is used:

# Redirect all cgi requests to my cgi server
redirect /cgi-bin/*    http://cgi-host/cgi-bin/* 

This redirect rule specifies that all CGI requests are redirected to another host named cgi-host.

For example, if the filer receives the following requests

http://toaster/cgi-bin/displayfares
http://toaster/cgi-bin/displaydates

the filer expands the wildcard character to displayfares and displaydates and redirects the requests to the host named cgi-host. To the client, the results of these requests are the same as the results of the following requests:

http://cgi-host/cgi-bin/displayfares
http://cgi-host/cgi-bin/displaydates

Copyright © 1999, Network Appliance, Inc. All rights reserved.

Part No. 210-02334
File: http6.htm
Last updated: 04/26/99 08:11:40