Sun Java System Portal Server Secure Remote Access 7.2 Administration Guide

Chapter 9 Configuring Rewriter in the Gateway Service

highlights content here.

This chapter has the following sections:

For more information on rewriter rules, see Defining Language Based Rules

For more information on Rewriter problems, see Troubleshooting Using Debug Logs.

For Rewriter examples, see Working Samples.

Creating a List of URIs to RuleSet Mappings

After the ruleset is created, associate a domain with the ruleset using the Map URIs to RuleSets field. The following two entries are added by default to the Map URIs to RuleSets field:

This means that for all pages from portal directory with the domain sun.com, the default_gateway_ruleset is applied. For all other pages, the generic ruleset is applied. The default_gateway_ruleset and the generic_ruleset are pre-packaged rulesets.


Note –

For all the content appearing on the standard Portal Desktop, the ruleset for the default_gateway_ruleset is used, irrespective of where the content is fetched from.

For example, assume that the standard Portal Desktop is configured to scrape the content from the URL yahoo.com. The Portal Server is in sesta.com. The ruleset for sesta.com is applied to the fetched content.



Note –

The domain for which you specify a ruleset must be listed in the Proxies for Domains and Subdomains list.


Using Wildcards Within the Syntax

You can map a fully qualified URI or a partial URI by using an asterisk in the ruleset.

For example, you could apply the java_index_page_ruleset to an index.html page as follows:

www.sun.com/java/index.html/java_index_page_ruleset

or you could apply all pages in the java directory to the java_directory_ruleset, as follows:

www.sun.com/java/* /java_directory_ruleset

Configuring Rewriter in the Gateway Service

Using the Gateway service, under the Rewriter tab, you can perform the following tasks within two categories, Basic and Advanced:

Basic Tasks

ProcedureTo Enable the Gateway to Rewrite All URLs

If you enable the Enable Rewriting of All URIs option in the Gateway service, Rewriter rewrites any URL without checking against the entries in the Proxies for Domains and Subdomains list. Entries in the Proxies for Domains and Subdomains list are ignored.

  1. Log into the Portal Server administration console as administrator.

  2. Select the Secure Remote Access tab, and select the gateway profile for which you want to modify the attributes.

  3. Select the Rewriter tab.

  4. Under Basic Options, select the Enable Rewriting of All URIs checkbox to enable the Gateway to rewrite all URLs.

  5. Click Save to complete.

  6. Restart the Gateway from a terminal window:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>
    

ProcedureTo Specify the URIs Not to Rewrite

  1. Log into the Portal Server administration console as administrator.

  2. Select the Secure Remote Access tab, and select the gateway profile for which you want to set the attribute.

  3. Select the Rewriter tab.

  4. Under Basic Option, enter the URI in the Add text field and then click Add.

    The URI values is displayed in the URIs Not To Rewrite box.


    Note –

    Adding #* to this list allows URIs to be rewritten, even when the href rule is part of the ruleset.


  5. Click Save to complete.

  6. Restart the Gateway from a terminal window:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>
    

ProcedureTo Map a URI to a RuleSet

  1. Log into the Portal Server administration console as administrator.

  2. Select the Secure Remote Access tab, and select the gateway profile for which you want to set the attribute.

  3. Select the Rewriter tab.

  4. Under Rewriter Options, click Map URI to Rulesets, and click Add Row.

  5. Enter the required domain or host name in the URI field and the enter appropriate ruleset for the domain in the Rule Set field.

    The entry is added to the Map URIs to RuleSets list. The format for specifying the domain or host name and the ruleset is as follows:


    domain name|ruleset name

    For example:


    eng.sesta.com|default
  6. Click Save to Complete.

  7. Restart the Gateway from a terminal window:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>
    

ProcedureTo Specify MIME Mappings

Rewriter has four different parsers to parse the web pages based on the content type: HTML, JAVASCRIPT, CSS and XML. Common MIME types are associated with these parsers by default. You can associate new MIME types with these parsers in the Map Parser to MIME Types field of the Gateway service. This extends the Rewriter functionality to other MIME types.

Separate multiple entries with a semicolon or a comma (";" or ",".) For example:

HTML=text/html;text/htm;text/x-component;text/wml; text/vnl/wap.wml

means any content with these MIMEs are sent to the HTML Rewriter and HTML rules would be applied to rewrite the URLs.


Tip –

Removing unnecessary parsers from the MIME mappings list can increase the speed of operation. For example, if you are sure that the content from a particular intranet will not have any JavaScript, you can remove the JAVASCRIPT entry from the MIME mappings list.


  1. Log into the Portal Server administration console as administrator.

  2. Select the Secure Remote Access tab, and select the gateway profile for which you want to set the attribute.

  3. Select the Rewriter tab.

  4. Under Rewriter Option, click Map Parser to Map MIME Types .

    Specify the entry in the format HTML=text/html;text/htm

  5. Click Add Row to add the entry to the list. Enter the parser value and corresponding MIME value to map to in the MIME Type filed.

  6. Click Save to complete.

  7. Restart the Gateway from a terminal window:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>
    

ProcedureTo Specify the Default Domains

The default domain and subdomain are useful when URLs contain only the host names without the domain and subdomain. In this case, the Gateway assumes that the host names are in the default domain and subdomain, and proceeds accordingly.

For example, if the host name in the URL is host1, and the default domain and subdomain are specified as red.sesta.com, the host name is resolved as host1.red.sesta.com.

  1. Log into the Portal Server administration console as administrator.

  2. Select the Secure Remote Access tab, and select the gateway profile for which you want to set the attribute.

  3. Select Deployment Tab.

  4. In the Proxies for Domains and Subdomains field, type the required domain name with out proxy.

  5. Click Save to complete.

  6. Restart the Gateway from a terminal window:


    ./psadmin start-sra-instance –u amadmin – f  <password file> –N <profile name>– t  <gateway>