Forum Discussion

darrenclegg_199's avatar
darrenclegg_199
Icon for Nimbostratus rankNimbostratus
Feb 21, 2011

URL and ip address blocking

I have an iRule that blocks users from using an ip address to access our sites and also stops the wrong URL accessing it (this was done because of an error in a forwarding rule on our proxy).

 

 

This rule blocks incorrect URLs and ip addresses from accessing the website (incase of misconfiguration on forwarding host)

 

 

when HTTP_REQUEST { if { not ([string tolower [HTTP::uri]] starts_with "/mysite.com/") }{

 

 

HTTP::respond 200 content \ "Wrong URL entered Access to this URL is not allowed using this method. Please inform the Network Administrator." "Content-Type" "text/html" } }

 

 

This works but is specific to mysite.com. Is there any way i can make this generic to all sites based on an allowed url list on ASM or any other method

 

 

cheers Darren

2 Replies

  • You could use a class/data group that contains all of the allowed URLs and if HTTP::uri doesn't start with one of them, issue the same response. Is that what you're after?
  • i have set up a http_class and added the URL allowed list and applied it to the profile. i didn't need any iRule statement.

     

     

    thanks Chris