Oracle iPlanet Web Proxy Server 4.0.14 Configuration File Reference

NameTrans

NameTrans stands for Name Translation. NameTrans directives translate virtual URLs to physical directories on your server. For example, the URL

http://www.test.com/some/file.html

could be translated to the full file system path

/usr/Sun/WebServer61/server1/docs/some/file.html

NameTrans directives should appear in the default object. If an object contains more than one NameTrans directive, the server executes each directive in order until one succeeds.

The following NameTrans-class functions are described in detail in this section

assign-name

Applicable in NameTrans-class directives.

The assign-name function specifies the name of an object in obj.conf that matches the current request. The server then processes the directives in the named object in preference to the ones in the default object.

For example, consider the following directive in the default object:

NameTrans fn=assign-name name=personnel from=/personnel

Suppose the server receives a request for http://server-name/personnel. After processing this NameTrans directive, the server looks for an object named personnel in obj.conf, and continues by processing the directives in the personnel object.

The assign-name function always returns REQ_NOACTION.

Parameters

The following table describes the parameters for the assign-name function.

Table 5–41 assign-name parameters

Parameter  

Description  

from

Wildcard pattern that specifies the path to be affected. 

name

Specifies an additional named object in obj.conf whose directives are applied to this request.

find-pathinfo-forward

(Optional) Makes the server look for the PATHINFO forward in the path after the ntrans-base instead of backward from the end of path as the server function assign-name does by default.

The value you assign to this parameter is ignored. If you do not want to use this parameter, do not include it. 

The find-pathinfo-forward parameter is ignored if the ntrans-base parameter is not set in rq->vars. By default, ntrans-base is set.

This feature can improve performance for certain URLs by reducing the number of stats performed. 

nostat

(Optional) Prevents the server from performing a stat on a specified URL whenever possible. 

The effect of nostat="virtual-path" in the NameTrans function assign-name is that the server assumes that a stat on the specified virtual-path will fail. Therefore, use nostat only when the path of the virtual-path does not exist on the system, for example, for NSAPI plug-in URLs, to improve performance by avoiding unnecessary stats on those URLs.

When the default PathCheck server functions are used, the server does not stat for the paths /ntrans-base/virtual-path and /ntrans-base/virtual-path/* if ntrans-base is set (the default condition); it does not stat for the URLs /virtual-path and /virtual-path/* if ntrans-base is not set.

bucket

(Optional) Common to all obj.conf functions.

Example


# This NameTrans directive is in the default object.
	NameTrans fn=assign-name name=personnel from=/a/b/c/pers...
	<Object name=personnel>...additional directives..</Object>
NameTrans fn="assign-name" from="/perf" find-pathinfo-forward="" name="perf"
NameTrans fn="assign-name" from="/nsfc"  nostat="/nsfc" name="nsfc"

document-root

Applicable in NameTrans-class directives.

The document-root function specifies the root document directory for the server. If the physical path has not been set by a previous NameTrans function, the http://server-name/ part of the path is replaced by the physical path name for the document root.

When the server receives a request for http://server-name/somepath/somefile, the document-root function replaces http://server-name/ with the value of its root parameter. For example, if the document root directory is /usr/sun/webserver61/server1/docs, then when the server receives a request for http://server-name/a/b/file.html, the document-root function translates the path name for the requested resource to /usr/sun/webserver61/server1/docs/a/b/file.html.

This function always returns REQ_PROCEED. NameTrans directives listed after this response are never called, so be sure that the directive that invokes document-root is the last NameTrans directive.

You can declare only one root document directory. To specify additional document directories, use the pfx2dir function to set up additional path name translations.

Parameters

The following table describes parameters for the document-root function.

Table 5–42 document-root parameters

Parameter  

Description  

root

File system path to the server’s root document directory 

bucket

(Optional) Common to all obj.conf functions

Examples


NameTrans fn=document-root root=/usr/sun/webserver61/server1/docsNameTrans 
	fn=document-root root=$docroot

         

See Also

pfx2dir

home-page

Applicable in NameTrans-class directives.

The home-page function specifies the home page for your server. This page is displayed whenever a client requests the server’s home page (/).

Parameters

The following table describes parameters for the home-page function.

Table 5–43 home-page parameters

Parameter  

Description  

path

Path and name of the home page file. A path that starts with a slash (/) and is assumed to be a full path to a file.

This function sets the server’s path variable and returns REQ_PROCEED. Relative paths are appended to the URI and the function returns REQ_NOACTION and then continues on to the other NameTrans directives.

bucket

(Optional) Common to all obj.conf functions.

Examples


NameTrans fn="home-page" path="/path/to/file.html"
NameTrans fn="home-page" path="/path/to/$id/file.html"

map

Applicable in NameTrans-class directives.

The map function looks for a certain URL prefix in the URL that the client is requesting. If map finds the prefix, it replaces the prefix with the mirror site prefix. Note that the trailing slashes in URL cause “Not Found” errors.

Syntax

NameTrans fn=map from="source site prefix" to="destination site prefix" name="named object"

Parameters

The following table describes parameters for the map function.

Table 5–44 map Parameters

Parameter  

Description  

from

The prefix to be mapped to the mirror site. 

to

The mirror site prefix. 

name

(optional) the object from which to derive the configuration for this mirror site. 

rewrite-host

(optional) Indicates whether the Host HTTP request header is rewritten to match the host specified by the to parameter. In a reverse proxy configuration where the proxy server and origin server service the same set of virtual servers, you may want to specify rewrite-host="false". The default is true, meaning that the Host HTTP request header is rewritten.

trailing-slash-redirect

(optional) Indicates whether a trailing slash redirect should be enabled or disabled. This is enabled by default. If disabled, when a client request's URL matches the value of the "from" parameter and does not have a trailing slash, the Proxy will not respond with a redirect with the trailing slash added. 

Example


# Map site http://home.netscape.com/ to mirror site http://mirror.com
NameTrans fn=map  from="http://home.netscape.com" to="http://mirror.com"

         

match-browser

See match-browser.

ntrans-j2ee

This function is applicable only to the Administration Server. It is applicable in NameTrans-class directives.

The ntrans-j2ee function determines whether a request maps to a Java web application context.

Parameters

The following table describes parameters for the ntrans-j2ee function.

Table 5–45 ntrans-j2ee parameters

Parameter  

Description  

name

Named object in obj.conf whose directives are applied to requests made to Java web applications

bucket

(Optional) Common to all obj.conf functions

Example


 NameTrans fn="ntrans-j2ee" name="j2ee"

See Also

service-j2ee, error-j2ee

pac-map

Applicable in NameTrans-class directives.

The pac-map function maps proxy-relative URLs to local files that are delivered to clients who request configuration.

Syntax

NameTrans fn=pac-map     from=URL    to=prefix    name=named object

Parameters

The following table describes parameters for the pac-map function.

Table 5–46 pac-map parameters

Parameter  

Description  

from

The proxy URL to be mapped. 

to

The local file to be mapped to. 

name

(optional) The object (template) from which to derive configuration. 

Example


NameTrans fn=pac-map  from=http://proxy.mysite.com/pac  
	to=<install-root><instance-directory>pac/proxy.pac name=file

pat-map

Applicable in NameTrans-class directives.

The pat-map function maps proxy-relative URLs to local files that are delivered to proxies who request configuration.

Syntax

NameTrans fn=pat-map     from=URL    to=prefix    name=named object

Parameters

The following table describes parameters for the pat-map function.

Table 5–47 pat-map parameters

Parameter  

Description  

from

The proxy URL to be mapped. 

to

The local file to be mapped to. 

name

(optional) The object (template) from which to derive configuration. 

Example


NameTrans fn=pat-map  from=http://proxy.mysite.com/pac  
	to=<install-root><instance-directory>pac/proxy.pac name=file

pfx2dir

Applicable in NameTrans-class directives.

The pfx2dir function replaces a directory prefix in the requested URL with a real directory name. It also optionally enables you to specify the name of an object that matches the current request. See the discussion of assign-name for details of using named objects.

Parameters

The following table describes parameters for the pfx2dir function.

Table 5–48 pfx2dir parameters

Parameter  

Description  

from

URI prefix to convert. Do not insert a trailing slash (/). 

dir

Local file system directory path that the prefix is converted to. Do not insert a trailing slash (/). 

name

(Optional) Specifies an additional named object in obj.conf whose directives will be applied to this request.

find-pathinfo-forward

(Optional) Makes the server look for the PATHINFO forward in the path after the ntrans-base instead of backward from the end of path as the server function find-pathinfo does by default.

The value you assign to this parameter is ignored. If you do not want to use this parameter, do not include it. 

The find-pathinfo-forward parameter is ignored if the ntrans-base parameter is not set in rq->vars when the server function find-pathinfo is called. By default, ntrans-base is set.

This feature can improve performance for certain URLs by reducing the number of stats performed in the server function find-pathinfo.

On Windows, this feature can also be used to prevent the PATHINFO from the server URL normalization process (changing ’\\’ to ’/’) when the PathCheck server function find-pathinfo is used. Some double-byte characters have hexadecimal values that may be parsed as URL separator characters such as \\ or ~. Using the find-pathinfo-forward parameter can sometimes prevent incorrect parsing of URLs containing double-byte characters.

bucket

(Optional) Common to all obj.conf functions.

Examples

In the first example, the URL http://server-name/cgi-bin/resource (such as http://x.y.z/cgi-bin/test.cgi) is translated to the physical path name /httpd/cgi-local/resource (such as /httpd/cgi-local/test.cgi), and the server also starts processing the directives in the object named cgi.


NameTrans fn=pfx2dir from=/cgi-bin dir=/httpd/cgi-local name=cgi

In the second example, the URL http://server-name/icons/resource (such as http://x.y.z/icons/happy/smiley.gif) is translated to the physical path name /users/nikki/images/resource (such as /users/nikki/images/smiley.gif).


NameTrans fn=pfx2dir from=/icons/happy dir=/users/nikki/images

         

The third example shows the use of the find-pathinfo-forward parameter. The URL http://server-name/cgi-bin/resource is translated to the physical path name /export/home/cgi-bin/resource.


NameTrans fn="pfx2dir" find-pathinfo-forward="" from="/cgi-bin" 
	dir="/export/home/cgi-bin" name="cgi"

redirect

Applicable in NameTrans-class directives.

The redirect function enables you to change URLs and send the updated URL to the client. When a client accesses your server with an old path, the server treats the request as a request for the new URL.

Parameters

The following table describes parameters for the redirect function.

Table 5–49 redirect parameters

Parameter  

Description  

from

Specifies the prefix of the requested URI to match. 

url/url-prefix

url specifies a complete URL to return to the client. url-prefix specifies the new URL prefix to return to the client. The from prefix is simply replaced by this URL prefix. You cannot use these parameters together.

escape

(Optional) Flag that tells the server to util_uri_escape the URL before sending it. It should be yes or no. The default is yes.

For more information about util_uri_escape, see Oracle iPlanet Web Proxy Server 4.0.14 NSAPI Developer’s Guide.

bucket

(Optional) Common to all obj.conf functions.

Examples

In the first example, any request for http://server-name/string is translated to a request for http://tmpserver/string.


NameTrans fn=redirect from=/ url-prefix=http://tmpserver

         

In the second example, any request for http://server-name/toopopular/string is translated to a request for http://bigger/better/stronger/morepopular/string.


NameTrans fn=redirect from=/toopopular 
	url=http://bigger/better/stronger/morepopular

regexp-map

Applicable in NameTrans-class directives.

The regexp-map is similar to the map function. While the map function looks for an exact match of a URL prefix, regexp-map allows a regular expression match.

Parameters

The following table describes parameters for the regexp-map function.

Table 5–50 regexp-map parameters

Parameter  

Description  

from

A regular expression for the prefix to be mapped to the mirror site. 

to

The mirror site prefix. 

name

(Optional) A named object from which to derive the configuration for the mirror site. 

rewrite-host

(Optional) Indicates whether the Host HTTP request header is rewritten to match the host specified by the parameter. In a reverse proxy configuration where the proxy server and origin server service the same set of virtual servers, you may wish to specify rewrite-host="false". The default is "true", meaning that the Host HTTP request header is rewritten.

reverse-map

Applicable in NameTrans-class directives.

The reverse-map function is used to rewrite HTTP response headers when the proxy server is functioning as a reverse proxy. reverse-map looks for the URL prefix specified by the from parameter in certain response headers. If the from prefix matches the beginning of the response header value, reverse-map replaces the matching portion with the to prefix.

Parameters

The following table describes parameters for the reverse-map function.

Table 5–51 reverse-map parameters

Parameter  

Description  

from

URL prefix to be rewritten. 

to

URL prefix that will be substituted in place of the from prefix. 

rewrite-location

(Optional) Boolean that indicates whether the Location HTTP response header should be rewritten. The default is true, meaning the Location header is rewritten.

rewrite-content-location

(Optional) Boolean that indicates whether the content-location HTTP response header should be rewritten. The default is true, meaning the Content-location header is rewritten.

rewrite-headername

(Optional) Boolean that indicates whether the headername HTTP response header should be rewritten, where headername is a user-defined header name. With the exception of the Location and Content-location headers, the default is false, meaning the headername header is not rewritten.

rewrite-set-cookie

Takes a boolean value and is set to true by default. Enables or disables cookie rewriting, which involves rewriting the domain and path parameters of the set-cookie headers.

cookiepath-from

Specifies the target value of the path parameter.

cookiepath-to

If the value of the path parameter matches the value of cookiepath-from, it will be rewritten to the value of cookiepath-to.

set-variable

See set-variable.

strip-params

Applicable in NameTrans-class directives.

The strip-params function removes embedded semicolon-delimited parameters from the path. For example, a URI of /dir1;param1/dir2 would become a path of /dir1/dir2. When used, the strip-params function should be the first NameTrans directive listed.

Parameters

The following table describes the parameter for the strip-params function.

Table 5–52 strip-params Parameters

Parameter  

Description  

bucket

(Optional) Common to all obj.conf functions

Example

NameTrans fn=strip-params

um-ntrans

Applicable in NameTrans-class directives.

The um-ntrans function determines if an inbound request is related to a junction or not. It also rewrites inbound cookies, adds headers, and does any rewriting when necessary, before the request is sent to the back-end server.

If a request cannot be mapped to a junction, it is passed through without modification.

This directive must appear exactly once in obj.conf, typically inside the default object.

Example


Nametrans fn="um-ntrans"

unix-home

Applicable in NameTrans-class directives.

UNIX Only. The unix-home function translates user names typically of the form ~username into the user’s home directory on the server’s UNIX machine. You specify a URL prefix that signals user directories. Any request that begins with the prefix is translated to the user’s home directory.

You specify the list of users with either the /etc/passwd file or a file with a similar structure. Each line in the file should have this structure. Elements in the passwd file that are not needed are indicated with *:

username:*:*:groupid:*:homedir:*

If you want the server to scan the password file only once at startup, use the Init-class function init-uhome in magnus.conf.

Parameters

The following table describes the parameters for the unix-home function.

Table 5–53 unix-home Parameters

Parameter  

Description  

subdir

Subdirectory within the home directory that contains the user's web documents. 

pwfile

(Optional) Full path and file name of the password file if it is different from /etc/passwd.

name

(Optional) Specifies an additional named object whose directives will be applied to this request. 

bucket

(Optional) Common to all obj.conf functions.

Examples


NameTrans fn=unix-home from=/~ subdir=public_html
NameTrans fn=unix-home from /~ pwfile=/mydir/passwd subdir=public_html

See Also

find-links