beautypg.com

Creating a csw policy, Binding a csw policy to the virtual server port – Brocade Virtual ADX Server Load Balancing Guide (Supporting ADX v03.1.00) User Manual

Page 288

background image

272

Brocade Virtual ADX Server Load Balancing Guide

53-1003247-01

Layer 7 content switching on HTTP response

5

Creating a CSW rule specifying the header response codes

In this step, the header response codes are specified, and a response is inspected only if those
codes are found. For example, to specify the redirect response code, the following configuration is
required.

Virtual ADX(config)#csw-rule r2 response-status-code 200 400

Syntax: [no] csw-rule rule-name response-status-code low_bound high_bound

Creating a CSW rule specifying the string to be modified

In this step, a CSW-Rule is configured that specifies the string to be matched in a given header. For
example, to match the string the redirect messages typically have response codes of 301 or 302,
and the new URL is specified in the header "Location."

For example, to match the redirect location "http://www.example6.com," the following rule is
required.

Virtual ADX(config)#csw-rule r11 response-header "Location" pattern

"http://www.example6.com"

Syntax: [no] csw-rule rule-name response-header header_name pattern pattern_to_be_found

Creating a CSW policy

When the rules have been defined, they need to be added to a CSW policy. The policy type
response-rewrite must be used so as to distinguish the response-rewrite policy from the original
CSW policies, like request-rewrite.

The two rules configured in step 1 and step-2 are added to this policy. The first rule ensures that
the policy acts only on responses with response codes 301 or 302. The second rule matches the
string "http://www.example6.com" and replaces it with "https://www.example6.com." The offset
and length defines the portion of the original match that has to be replaced. The example below
shows the rewriting of the entire string. Alternatively, only the first four characters can also be
modified, in which case the offset would be 0, with length 4, and the new string would be "https."

Virtual ADX(config)#csw-policy "p1" type response-rewrite

Virtual ADX(config-rew-p1)#match "r1" rewrite response-insert header

Virtual ADXconfig-rew-p1)#match "r11" rewrite request-replace string

"https://www.example6.com/" offset 0 length 19

Syntax: [no] csw-policy policy-name type response-rewrite

Binding a CSW policy to the virtual server port

The final step is to apply the CSW policy to the incoming traffic by binding it to a virtual port. This
type of policy is usually applied on port HTTP.

Virtual ADX(config)#server virtual-name-or-ip v1 10.1.1.10

Virtual ADX(config-vs-v1)#port http response-rewrite-policy "p22"

Syntax: port port-type response-rewrite-policy policy-name