We use cookies on our website to ensure we provide you with the best experience on our website. By using our website, you agree to the use of cookies for analytics and personalized content.This website uses cookies. More Information
It seems like your browser didn't download the required fonts. Please revise your security settings and try again.
Barracuda Load Balancer ADC

Content Rules for HTTP and HTTPS Services

  • Last updated on

You can add content rules to direct incoming requests for an HTTP or HTTPS service to one or more real servers, based on the host, URL, or other HTTP header fields of the request. If a request does not match any content rule, it is directed to a real server that has been added to the service.

Pattern Matching

When you create a content rule, enter the following patterns to match the requests that you want to be handled by the rule:

  • Host Match – The host or domain name to match in the host header of the requests.
  • URL Match – The URL to match in the URL header of the requests.
  • Extended Match – An expression consisting of a combination of HTTP headers and/or query string parameters. The extended match pattern in a rule is evaluated only if the host and URL pattern are matched to the request. If a request does not match any extended match expressions for the rule, then the request is considered to have failed to match the rule. For more information on extended match and condition expressions, see Extended Match and Condition Expressions.

You can have multiple rules with the same host and URL match patterns but different extended match patterns. These rules are evaluated sequentially by the extended match sequence number that you assign to them.

If there are multiple content rules for a service, the rule that matches a request most closely is executed. For example, if a service has these two rules:

  • Rule A – host  www.example.com, URL /images/*
  • Rule B – host www.example.com, URL /images/*.png

and the incoming request is for www.example.com/images/x.png, rule B is executed. If a rule has the most specific host and URL for a request, any Extended Match expressions for that rule are evaluated in the order established by the Extended Match Order field. If the request does not match any Extended Match expression for the rule then the request is considered to have failed to match any rule.

You can include %s in the URL to redirect to the domain (URL) specified appending the same requested URL. For example,

  • Service: http://www.home.com
  • URL Match: /*
  • Redirect URL: http://www.redirect.com%s

When a request such as http://www.home.com/a.html is sent, it is redirected to http://www.redirect.com/a.html

You can also use % in the URL to offset characters. For example,

  • Service: http://www.home.com/abc
  • URL Match: /*
  • Redirect URL: http://www.redirect.com/test/*

If you use %s, the redirected URL would be http://www.redirect.com/test/abc instead of http://www.redirect.com/test/*.

In this case, specify the Redirect URL as http://www.redirect.com/%4s. This format will copy anything in the URL match after 4 characters.


Create a Content Rule

To create a content rule for an HTTP or HTTPS service:

  1. Go to the BASIC > Services page.
  2. In the left pane, select the service.
  3. Click the Add Content Rule option that appears.
  4. In the Add Content Rule window, enter a name for the rule, enter the patterns to match the requests that you want to be handled by the rule, and specify how the requests are distributed to the real servers for the rule.
  5. Click Create. The content rule settings appear in the main pane of the web interface.
  6. In the Configured Servers section, click Add Server to add and configure the real servers that you want to handle the requests that match the rule.

 

redirect rules

Last updated on