Oracle iPlanet Web Proxy Server 4.0.14 Configuration File Reference

ObjectType Directive

Assuming that the PathCheck directives all approve access, the server next executes the ObjectType directives to determine the MIME type of the request. The MIME type has three attributes: type, encoding, and language. When the server sends the response to the client, the type, language, and encoding values are transmitted in the headers of the response. The type also frequently helps the server to determine which Service directive to execute to generate the response to the client.

If the object contains more than one ObjectType directive, the server applies all of the directives in the order in which they appear. However, once a directive sets an attribute of the MIME type, further attempts to set the same attribute are ignored. All ObjectType directives are applied because one directive may set one attribute, for example type, while another directive sets a different attribute, such as language.

As with the PathCheck directives, if another object has been matched to the request as a result of the NameTrans step, the server executes the ObjectType directives in the matching object before executing the ObjectType directives in the default object.

Setting the Type by File Extension

Usually, the default way the server determines the MIME type is by calling the type-by-extension function. This function instructs the server to look up the MIME type according to the requested resource’s file extension in the MIME types table. This table is created during virtual server initialization by the MIME types file, which is usually called mime.types.

For example, the entry in the MIME types table for the extensions .html and.htm is usually:

type=text/html  exts=htm,html

This table indicates that all files with the extension .htm or .html are text files formatted as HTML, and the type is text/html.

If you make changes to the MIME types file, you must reconfigure the server before those changes can take effect.

Forcing the Type

If no previous ObjectType directive has set the type and the server does not find a matching file extension in the MIME types table, the type still has no value even after type-by-expression has been executed. If the server does not recognize the file extension, force the type to be text/plain, so that the content of the resource is treated as plain text. Another situation in which you can set the type regardless of the file extension is forcing all resources in the designated CGI directory to have the MIME type magnus-internal/cgi.

The function that forces the type is force-type.

For example, the following directives first instruct the server to look in the MIME types table for the MIME type. Then, if the type attribute has not been set (that is, the file extension was not found in the MIME types table), set the type attribute to text/plain.


ObjectType fn="type-by-extension"
ObjectType fn="force-type" type="text/plain"

            

If the server receives a request for a file abc.dogs, it looks in the MIME types table. When it does not find a mapping for the extension .dogs, it consequently does not set the type attribute. Because the type attribute has not already been set, the second directive is successful, forcing the type attribute to text/plain.

The following example illustrates another use of force-type. In this example, the type is forced to magnus-internal/cgi before the server gets a chance to look in the MIME types table. In this case, all requests for resources in http://server_name/cgi/ are translated into requests for resources in the directory <install-root>/<instance-directory>/mycgi/. Since a name is assigned to the request, the server processes ObjectType directives in the object named cgi before processing the ones in the default object. This object has one ObjectType directive, which forces the type to be magnus-internal/cgi.


NameTrans fn="pfx2dir" from="/cgi" dir="<
               install-root>/<
               instance-directory>/mycgi" name="cgi"
<Object name="cgi">
ObjectType fn="force-type" type="magnus-internal/cgi"
Service fn="send-cgi"
</Object>

            

The server continues processing all ObjectType directives including those in the default object. However, because the type attribute has already been set, no other directive can set it to another value.