Forum Discussion

Gustavo_Lazarte's avatar
Gustavo_Lazarte
Icon for Nimbostratus rankNimbostratus
Aug 22, 2006

iRule Not working properly

I have the following iRule setup for my enviroment for reverse proxy

 

 

when HTTP_REQUEST {

 

if {[HTTP::uri] contains "***.***.***.148"}{

 

if {[HTTP::uri] ends_with ".jpg"}{

 

node 10.1.0.50 80

 

} else {

 

pool rewards

 

}

 

}

 

}

 

 

the Default pool is "cache" with the 10.1.0.50 cache server

 

the webserver pool is rewards.

 

 

it is caching correctly but I am also getting all type of other request on

 

my logs. This rule I should only allow .jpg requsts on my cache server.

 

 

Any ideas

 

 

Thanks

 

 

ps I am using BIG-IP 9.0.5 Build 59.7

 

 

3 Replies

  • You are comparing the URI for containment of the string "***.***.***.148" Do your URI's really contain this string?

     

     

    http://www.foo.com/path/***.***.***.148/file.jpg

     

     

    Also, just wanted to make sure to make sure you knew that the "contains" operator doesn't work on wildcards so it would be comparing for an exact string match. Just in case your uri's had an address embedded in them. You'd have to do a regular expression match or a switch/glob option for this to work.

     

     

    If you are trying to mask off of a client or virtual address, you are going to have to use one of the IP::*_addr methods to extract that value for comparison.

     

     

    I'm still trying to figure out why you are masking out all but the last value, it's usually the other way around. This would mean that anyone coming in with an address ending in 148 would be allowed access.

     

     

    More details would really help us help you...

     

     

    -Joe
  • Is it possible that you mean for the IP address to be the server and not the uri? It sounds to me like you mean for that to be the host, and that the asterisks were put in to mask the true IP address of your environment for the sake of security. I may be wrong, but if that is the case, try changing the first if statement to {[HTTP::host] equals "***.***.***.148"}, where the address is the true IP.

     

     

    If this is not the case, I, too, am interested in the questions Joe asked.