Understanding URL Rewrite Rules

Understanding URL Rewrite Rules

Use the WEBSITES > URL Rewrites page to create rules to modify inbound HTTP requests and outbound response rules for Layer 7 - HTTP Services. From this page you can:

  • Create rewrite rules to modify incoming HTTP request headers and URLs

  • Create rewrite rules to modify outbound HTTP response headers

  • Create rules to rewrite any text string in an outbound HTTP response body

 

Layer 7 - HTTP Services

Once you select a Layer 7 HTTP Service in the WEBSITES > URL Rewrites page,  the page refreshes to show the rules for the selected service.

HTTP Request Rewrite Conditions

A request rewrite condition is made up of one or more expressions. An expression consists of an operand, an operator, and a matching value.

 

HTTP Request Rewrite

An HTTP request rewrite is applied to the HTTP request coming from the client to the Barracuda Load Balancer.

 

Table 1. HTTP Request Rewrite Operators

Table 1 describes the operators you can use in the request rewrite condition expression:

 

Table 2. HTTP Response Rewrite Expression Tokens

Table 2 describes the tokens available for joining expressions:

 

Table 3. HTTP Response Rewrite Expression Operands

Table 3 describes the possible operands for the expression; all keywords are case insensitive:

 

HTTP Response Rewrite Conditions

A response rewrite condition is made up of one or more expressions consisting of an operand, an operator, and a matching value.

 

HTTP Response Rewrite

An HTTP Response rewrite is applied to the HTTP response going out from the servers to the client through the Barracuda Load Balancer.

 

Table 4. HTTP Response Rewrite Expression Operators

Table 4 describes the operators you can use in the response rewrite condition expression:

 

Table 5. HTTP Response Rewrite Expression Tokens

Table 5 describes the expressions available for joining expressions:

 

Table 6. HTTP Response Rewrite Expression Operands

Table 6 describes the possible operands for the expression; all keywords are case insensitive:

 

Response Body Rewrite

You can create rules for searching and replacing any string in the body of outbound responses. Only responses where the content-type begins with text/ (text/html, text/plain, text/javascript, text/css, text/xml) are searched, not flash or applet content. Table 7 lists the response body rewrite values.

Search and replace strings must be text; regular expressions cannot be used. Additionally, because meta-characters such as \r or \n cannot be used, you cannot search and replace any multi-byte character set strings.

 

Table 7. Response Body Rewrite Values

Table 7 describes the Response Body Rewrite Rule fields:

 

 

Additional Information

For more information on creating URL Rewrite rules, log into the Barracuda Load Balancer web interface, go to the WEBSITES > URL Rewrites page, and click the Help button.

For a Response Body Rewrite example, refer to the article How to Use the Response Rewrite Function to Enable Web Sites for Google Analytics.