Enable junction rewrite (optional)

This applies to reverse proxy configurations only.

The JunctionRewrite directive enables the junction rewriting routine within the Caching Proxy to rewrite responses from origin servers to ensure that server-relative URLs get mapped to the appropriate origin server when junctions are used. The junction rewriting plug-in must also be enabled. Junctions are defined by the proxy mapping rules.

When using the proxy mapping rules to define the junction, you can use the Proxy directive with or without the JunctionPrefix option.

Define the junction without the JunctionPrefix option

The following are examples of valid junctions that can be acted upon by the junction rewriting routine:

The following is an example of a valid junction that will not be acted upon by the junction rewriting routine:

The following are examples of invalid junctions:

These mapping rules have created junctions for shopserver, authserver, and b2bserver. Consider that shopserver returns an HTML document with the following URLs contained within appropriate HTML tags:

The junction rewriting routine will rewrite the server relative references using the proxy mapping rules as follows:

Define the junction with the JunctionPrefix option (recommended method)

When using the JunctionPrefix option with the Proxy directive, instead of inferring the JunctionPrefix from the first URL pattern in the Proxy rule, you can declare the junction prefix in the Proxy rule using the following format:

Proxy url_patern1 url_pattern2 JunctionPrefix:url_prefix

When using JunctionPrefix there is no limitation on the format of the first URL pattern. In order to support junction rewriting when not using the JunctionPrefix option, the proxy URL must have the following format: Proxy /market/* http://b2bserver/*. However, when using JunctionPrefix, the following Proxy rule is valid for junction rewriting:

Proxy  /market/partners/*.html http://b2bserver.acme.com/*.html
       junctionprefix:/market/partners

The junction rewriting routine affects the following tags:

Table 3. Tags affected by the junction rewriting routine
Tag Attributes
!-- URL
a href
applet archive, codebase
area href
base href
body background
del cite
embed pluginspage
form action
input src
frame src, longdesc
iframe src, longdesc
ilayer src, background
img src, usemap, lowsrc, longdesc, dynsrc
layer src, background
link href
meta url
object data, classid, codebase, codepage
script src
table background
td background
th background
tr background
Note:
The junction rewriting routine will not affect tags generated by JavaScript or by plug-ins within the browser.

Associated directives

The following directives are used to enable the junction rewriting routine and plug-in.

For more information, refer to Manually editing the ibmproxy.conf file.

Configuration and Administration forms

The following Configuration and Administration form can be used to enable the junction rewriting plug-in:

Note:
The Configuration and Administration forms do not support the JunctionRewrite directive.

For more information, refer to Using the Configuration and Administration forms.

UseCookie as an alternative to JunctionRewrite

You can use cookies to store back-end server information as follows: A cookie is sent to the client browser. When the browser sends requests for the resources in the HTML page, it attaches a cookie so that Caching Proxy forwards the requests to the correct back-end server.

To use cookies as an alternative to JunctionRewrite, make the following modifications to the ibmproxy.conf file:

  1. Change JunctionRewrite on with JunctionRewrite on UseCookie.
  2. Comment out the JunctionRewrite plugin.

The following is a comparison of the JunctionRewrite plugin and the cookie implementation.

Sample transmogrifier plugin to extend JunctionRewrite functionality

Customizable sample code is provided that rewrites and parses JavaScript™ (SCRIPT) and applet (APPLET) tag blocks in HTML files. Alone, the JunctionRewrite plugin cannot process the resource links in JavaScript or in parameter values of Java™.

After installing Caching Proxy, you can compile the same code and configure it to run with JunctionRewrite.

The following sample files are located in the ...samples/cp/ subdirectory, under the directory in which you downloaded the fix pack.