Chapter 6: Definition Reference
265
define url_rewrite
Defines rules for rewriting URLs embedded in tags within HTML, CSS, JavaScript or ASX documents.
This transformer takes effect only if it is also invoked by a
transform action in a define action
definition block, and that block is in turn called from an
action( ) property.
For each url found within an HTTP response, a
url_rewrite transformer first converts the URL into
absolute form, then finds the first
subst_embedded or subst_prefix statement whose
server_URL_substring matches the URL being considered. If such a match is found, then that
substring is replaced by the
client_url_substring.
Matching is case-sensitive by default; use the optional
caseless keyword for case-insensitive
matching. All
subst_embedded statements after the first occurrence of the caseless keyword use
case-insensitive string matching.
Multiple URL prefix substitutions can be made in a single
define url_rewrite definition block. This
type of transformation is often used in conjunction with the request URL form of the
rewrite( )
action in a server portal application.
To find URLs within an HTTP response, the ProxySG looks for
Location:, Content-Location:, and
Refresh: headers, and parses HTML, JavaScript, CSS, and ASX files. The ProxySG does not search for,
nor rewrite relative URLs embedded within Javascript.
Note: Pages served over an HTTPS tunneled connection are encrypted, so URLs embedded within
them cannot be rewritten.
Transformed content is not cached (although the original object may be), in contrast with
content that has been sent to a virus scanning server. This means any transformer can be safely
triggered based on any condition, including client identity and time of day.
Replaces:
transform url_rewrite
Syntax
define url_rewrite transformer_id
[caseless]
subst_embedded "client_url_substring" "server_url_substring"
subst_prefix "client_url_substring" "server_url_substring"
...
end
where:
•
transformer_id—A user-defined identifier for a transformer definition block. Used to invoke the
transformer using the
transform action in a define action definition block.
•
subst_embedded—Matches server_url_substring anywhere in the URL.
•
subst_prefix—Matches server_url_substring as a prefix of the URL.
•
client_url_substring—A string that will replace server_url_substring when that string is
matched for a URL in the retrieved document. The portion of the URL that is not substituted is
unchanged.