Forum Discussion

Shawn_Puckett_8's avatar
Shawn_Puckett_8
Icon for Nimbostratus rankNimbostratus
Jan 26, 2006

IP blocking and URI Redirect

We need two rules to be validated before a user is sent to a pool, first we need to make sure they are coming from an allowed IP, then we need to see if they want to go to a specific server via the URI.

 

 

So the IP check is easy to do with something like this:

 

 

when CLIENT_ACCEPTED

 

{

 

if {[IP::addr [IP::remote_addr] equals 205.229.151.206/255.255.255.255]} or

 

{[IP::addr [IP::remote_addr] equals 65.61.115.222/255.255.255.255]}

 

{pool QATest01-02-Port80}

 

else

 

{reject}

 

}

 

 

And the URI redirect to different pools is also easy to do with something like:

 

 

when HTTP_REQUEST

 

{

 

if {[HTTP::uri] contains "qatest01"}

 

{pool QATest01-Port80}

 

if {[HTTP::uri] contains "qatest02"}

 

{pool QATest02-Port80}

 

else

 

{pool QATest01-02-Port80}

 

}

 

 

But I'm not sure how to combine them.

 

 

I do have one additional question, there is about 20 IPs that are allowed in so I want to know if there is a better way to do that then what I have, or is that the approach the best?

 

 

Thanks,

 

Shawn