ProxySG Content Policy Language Guide
238
URL is considered complete, and replaces any URL that contains a substring matching the
regex_pattern substring. Sub-patterns of the regex_pattern matched can be substituted in
replacement_url using the $(n) syntax, where n is an integer from 1 to 32, specifying the
matched sub-pattern. For more information, see Appendix D: "CPL Substitutions".
replacement_host—A quoted string that can optionally include one or more variable
substitutions, which replaces the host portion of the URL once the substitutions are performed.
Note that the resulting host is considered complete, and it replaces the host in the URL forms
specified. Sub-patterns of the regex_pattern matched can be substituted in replacement_host
using the $(n) syntax, where n is an integer from 1 to 32, specifyi ng the matched sub-patter n. For
more information, see Appendix D: "CPL Substitutions".
URL_form1, ...—An optional list of up to three forms of the request URLs that will have the
URL or host replaced. If this parameter is left blank, all three forms are rewritten. The following
are the possible values:
logRequest URL used when generating log messages.
cacheRequest URL used to address the object in the local cache .
serverRequest URL sent to the origin server.
replacement_component—A quoted string that can optionally include one or more variable
substitutions, which replaces the entire component of the header matched by the regex_pattern
substring. Sub-patterns of the regex_pattern matched can be substituted in
replacement_component using the $(n) syntax, where n is an integer from 1 to 32, indicating the
matched sub-pattern. For more information, see Appendix D: "CPL Substitutions".
Discussion
Any rewrite of the server form of the request URL must be respected by policy controlling upstream
connections. The server form of the URL is tested by the server_url= conditions, which are the only
URL tests allowed in <Forward> layers.
All forms of the URL are available for access logging. The version of the URL that appears in a specific
access log is selected by including the appropriate substitution variable in the access log format:
c-uri—The original URL
cs-uri—The log URL, used when generating log messages
s-uri—The cache URL, used to address the object in the local cache
sr-uri—The server URL, used in the upstream request
In the absence of actions that modify the URL, all of these substitution variables represent the same
value.
Layer and Transaction Notes
Use in <Proxy> and <Cache> layers.
Do not use in <Exception>, <Forward>, or <Admin> layers.
URL and host rewrites apply to all transactions. Header rewrites apply to HTTP transactions.
Example
rewrite(url, "^http://www\.ijk\.com/(.*)", "http://www.server1.ijk.com/$(1)")