Chapter 5: Action Reference

redirect( )

Ends the current HTTP transaction and returns an HTTP redirect response to the client by setting the policy_redirect exception. Use this action to specify an HTTP 3xx response code, optionally set substitution variables based on the request URL, and generate the new Location response-header URL after performing variable substitution.

FTP over HTTP requests are redirected for Netscape Navigator clients, but not Microsoft Internet Explorer clients. To avoid this issue, do not use the redirect( ) action when the url.scheme=ftp condition is true. For example, if the http_redirect action definition contains a redirect( ) action, you can use the following rule:

url.scheme=ftp action.http_redirect(no)

Note: An error results if two redirect( ) actions conflict. The error is noted at compile time if the conflicting actions are within the same action definition block. A runtime error is recorded in the event log if the conflicting actions are defined in different blocks.

Important: It is possible to put the browser into an infinite redirection loop if the URL that the browser is being redirected to also triggers a policy-based redirect response.

Syntax

redirect(response_code, regex_pattern, replacement_url)

where:

response_code—An HTTP redirect code used as the HTTP response code; supported codes are 301, 302, 305, and 307.

regex_pattern—A quoted regular-expression pattern that is compared with the request URL based on an anchored match. If the regex_pattern does not match the request URL, the redirect action is ignored. A regex_pattern match sets the values for substitution variables. If no variable substitution is performed by the replacement_url string, specify ".* " for regex_pattern to match all request URLs. For more information about regular expressions, refer to Appendix E, “Using Regular Expressions,” in the Blue Coat ProxySG Configuration and Management Guide.

replacement_url—A quoted string that can optionally include one or more variable substitutions, which replaces the entire URL once the substitutions are performed. The resulting 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".

Layer and Transaction Notes

Use in <Proxy> or <Cache> layers.

Do not use in <Admin>, <Forward>, or <Exception> layers.

See Also

Actions: rewrite(url.host, host_regex_pattern, replacement_host), rewrite(url, regex_pattern, replacement_url), set(url.port, port_number)

Conditions: exception.id=

235

Page 235
Image 235
Blue Coat Systems Proxy SG manual Redirect