beautypg.com

Configuring rewrite request-replace – Brocade Virtual ADX Server Load Balancing Guide (Supporting ADX v03.1.00) User Manual

Page 278

background image

262

Brocade Virtual ADX Server Load Balancing Guide

53-1003247-01

Layer 7 content switching

5

The highlighted URLs in the following two HTTP request messages show the difference between the
original request and the rewritten request. Offset 0 is at the first "x," which is right after the
matched prefix "/ abc/," as defined in CSW "r22". Therefore, negative offset 5 is at the first "/,"
which is 5 bytes away from and before the "x." The result is that string "/hello-world" is inserted at
the first "/", which is the beginning of URL "/abc/xyz/index.html". The original URL becomes
"/hello-world/abc/xyz/index.html".

Example Original HTTP request:

GET /abc/xyz/index.html HTTP/1.1\r\n

Host: www.example5.com\r\n

User-Agent: Mozilla/5.0 Netscape/7.02\r\n

Accept-Charset: ISO-8859-1\r\n

Cookie: name=brocadenet; userid=12345\r\n

\r\n

Example Rewritten HTTP request:

GET /hello-world/abc/xyz/index.html HTTP/1.1\r\n

Host: www.example5.com\r\n

User-Agent: Mozilla/5.0 Netscape/7.02\r\n

Accept-Charset: ISO-8859-1\r\n

Cookie: name=brocadenet; userid=12345\r\n

\r\n

NOTE

When inserting a string in an HTTP request, make sure the negative offset is correctly specified.
Incorrectly specifying the negative offset (out of range) may result in an improper HTTP request.

Configuring Rewrite request-replace

Content replacement allows you to replace a defined string, or a string that matches a CSW rule.
The following procedures explain both methods.

Replacing a string defined by content rule
To configure a request to replace a string that matches a CSW rule, follow these steps.

1. Define a CSW rule for HTTP URL content.

Virtual ADX(config)#csw-rule r31 url exist

Syntax: csw-rule rule-name url exist

2. Define a CSW policy

Virtual ADX(config)#csw-policy mypolicy

Syntax: csw-policy policy-name

3. Specify a primary action.

Virtual ADX(config-csw-mypolicy)#match r31 forward 1025

Syntax: match rule-name forward server-id

4. Specify a dependent rewrite action.

Virtual ADX(config-csw-mypolicy)#match r31 rewrite request-replace

matched-string "/newabc/newxyz/newindex.html"