irules for reject


if client browser " balance test_pool ,else reject or another pool

You might need to use HTTP::host rather using HTTP::uri

you can find the documents here

when HTTP_REQUEST {
  if { [string tolower [HTTP::host]] equals "www.abc.com" } {
   pool test_pool_01
  } else {
  pool test_pool_02
 }
}

-Jinshu

This might be of help.

The error very likely arises from the lack of spaces in the source code. You have this:

when HTTP_REQUEST {
    if{[HTTP::uri] contains"http://www.abc.com"}{

At a minimum, you need a space between if and the open brace, as well as between contains and the following quote ("):

if {[HTTP::uri] contains "http://www.abc.com"}{

or the parser will fail.

As also pointed out above, though, there are a few logic errors. Those won’t cause a syntax error, but they will mean your code won’t do what you want.

When a person types "; in his browser, the user-agent generates an HTTP Request message. That message will look something like this:

GET / HTTP/1.1
Host: www.abc.com
User-Agent: Mozilla/4.0 (compatible; MSIE5.01; Windows NT)
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: Keep-Alive

That first line (the one beginning with “GET”) is the Start-Line. It is structured as follows:

HTTP::uri retrieves the part. Notice that HTTP::uri specifically does NOT return the URI entered into the user-agent. See the “Elaboration” section in this article for more details:

HTTP::host (a short-hand for HTTP::header value Host) retrieves the “Host” header, which is not embedded in the (and hence, not returned as part of HTTP::uri).

As that iRule recipe also explains, in general, when using HTTP::host, it makes sense to wrap it in string tolower, just as @Jinshu does.

Not sure what you mean by “if client browser”. But I think you want something like this?

if { [HTTP::host] eq “” } { pool test_pool } else { reject }

@John Heyer , you are right,3Q