Forum Discussion

genseek_32178's avatar
genseek_32178
Icon for Nimbostratus rankNimbostratus
Nov 06, 2013

iRule Query

Hi Experts,

 

Can we write a irule that accepts/rejects request from say Opera and accepts requests only from Safari?

 

If yes, please provide the full irule, it would be very helpful.

 

thanks - genseek

 

7 Replies

  • Yes you can, based on the HTTP header User-Agent value. Please do a search here on DC for User Agent and you should find lots of examples. Sorry but I'm forced to use IE8 in the daytime and search won't work for me at all.

     

    • What_Lies_Bene1's avatar
      What_Lies_Bene1
      Icon for Cirrostratus rankCirrostratus
      Any problems let me know and I can search myself later when I've got access to a better browser.
  • This will give you an idea;-

    switch -glob [HTTP::header User-Agent] {
        "*AppleWebKit*Safari*" {
             Do nothing - request allowed
        }
    
        default {
            HTTP::respond 403 Content "Invalid client type"
            return
        }
    }
    
    • genseek_32178's avatar
      genseek_32178
      Icon for Nimbostratus rankNimbostratus
      thanks IheartF5 for the sample iRule. Please correct my understanting of it: switch -glob [HTTP::header User-Agent] { "*AppleWebKit*Safari*" { Do nothing - request allowed }----------------------------------------------------this part says alow requests from Safari to the pool default { HTTP::respond 403 Content "Invalid client type" return } }-----------------------------------this part am not sure. Does it mean, request from any other browsr to send invalid request.
    • Thomas_Gobet's avatar
      Thomas_Gobet
      Icon for Nimbostratus rankNimbostratus
      Yes the last part (the default one) will respond to all toher web browsers they are invalid client type. But you can add a case to the switch on Opera to block request with this client type and accept others