Rewrite Filter Configuration for iChain 2.0

Novell Cool Solutions: Tip

Digg This - Slashdot This

Posted: 17 Dec 2001

Version: iChain 2.0

How to configure REWRITE for iChain2.0

Rewrite Filter Configuration
Rewrite filter (rewrite.nlm) configuration is accomplished via text files. An example of a configuration file is given below:


html, htm


var xsport ="9003"<<>> var xsport ="443"
var xsname ="xyz01"<<>> var xsname ="www"
var xconnectMode = "http"<<>> var xconnectMode = "https"
<PARAM name=serverHost value="xyz01.novell.com"><<>><PARAM name=serverHost value="www.novell.com">
<PARAM name=serverPort value="9003"><<>><PARAM name=serverPort value="443">
<PARAM name=connectMode value="https"><<>><PARAM name=connectMode value="http"

[Name=<filtername>]: This is the name of the rewriter filter. It is used for filter identification in rwfilter commands.

[Extension]: The user can specify file extensions (in a single line) which need to be parsed. This section is optional, but if this section is not specified, all extension types will be parsed. Specifying this section will result in the parsing only specified extensions.

Conditions: All extensions should be specified in a single line (just after the Extensions section header). Individual extension elements should be separated by a comma.

For example:


Parses files with html extensions.
Parses http://www.novell.com/index.html.

Does not parse http://www.novell.com/logo.gif.
Does not parse http://www.novell.com.

html, htm, txt, ,

Parses files with extensions html, htm, txt, and any default files implied by a trailing slash (/).
Parses http://www.novell.com/license.txt.
Parses http://www.novell.com/.
Does not parse http://www.novell.com/logo.gif.

[URL]: This section lists all URLs to be parsed. The rules of URL specification are similar to the ACLCheck module as follows:

www.novell.com: Exact match
www.novell.com/contact/: All files in contact directory, but not in subdirectories.
www.novell.com/contact/*: All URLs starting with www.novell.com/contact, including subdirectories of contact.

[Replace]: The user can specify replacement pairs in this section. The string "<<>>" is used as a separator between the original string an the new string. The format is as follows:

<search string><<>><replacement string>

All the lines afer this Replacement section header will be treated as replacement string pairs, so this should be the last section in the file.

Conditions: The Replace section should be the last one in the file. Each replacement pair (including the last one) must be terminated with the end of the line.

The name of the filter module is REWRITE.NLM. Configuration files could be supplied as command line parameters to filter.

Filename restrictions: Rewrite.nlm does not place any restrictions on the configuration filename format, but files which do not conform to DOS filename format (8.3) format) could cause errors while loading the file.

Load Time Command Line Options: The load time command line option is: rewrite -s -f system/accell.rw -f etc/accel2.rw.


-s: Create separate screen for rewrite filter
-f: Config file. This is the file from which configuration information is loaded. The user can specify as many config files as required. In the example above, accell.rw and accel2.rw are two configuration files in the specified format.

Runtime Console Commands
The following runtime console commands are also implemented:

rwfilter unload : Stops a filter (the filter name is as given in the configuration file).
rwfilter load : Loads a filter config file.
rwfilter list: Lists all loaded rewrite filters by name.
rwfilter print : Displays rewrite configuration information (the filter name is as given in the configuration). Printed information should be similar to the configuration file.

Replacement Rules
The following are simple rules that the iChain rewrite filter uses:

String replacement is done as a single pass.
String replacement is not performed recursively. For example:

If the original string is DOG, the rewritten string will be CAT. That is, only one replacement will occur (CAT will not be further replaced with CAT).

Since string replacement is done in one pass, the string that matches first will take precedence. For example:

If the original string is ABCDEFGH, the replaced string is XYZDEFGH.

If two user-specified strings match the data portion, the original string of higher length will be used for replacement except in cases detailed in point 3 above. For example:

If the original string is ABCDEFGH, the replaced string looks like PQRSTUVWXYZGH.

The rewrite filter module, REWRITE.NLM, applies only one matching filter (each configuration filter file constitutes a filter) for a request. If multiple filters match a request URL, the matching filter that was configured most recently will be used for data parsing. .

For more information and updates see TID: 10066302

Additional Information:

Rewrite Filter Configuration - Novell Online Documentation

Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© Micro Focus