Forum Discussion

mfkk531_168091's avatar
mfkk531_168091
Icon for Nimbostratus rankNimbostratus
Jan 06, 2016

Irule to only allow IE to access the site, elkse redirect to different URL

Hi DC Community,

 

I'm in need of a irule that allows only IE to access the site. If user tries in different browser (desktop/mobile) they should be redirected to a different url.

 

 

Thanks in advance. This will really help me.

 

2 Replies

  • nathe's avatar
    nathe
    Icon for Cirrocumulus rankCirrocumulus

    How about this? Using Google as a test redirect

    when HTTP_REQUEST {
        if { not ([string tolower [HTTP::header User-Agent]] contains "msie") } {
             HTTP::redirect "http://www.google.co.uk/"
     }
    }
    
  • I haven't been able to test this just yet, but should cover all IE UAs and mobile.

    when HTTP_REQUEST {
        if {!([string tolower [HTTP::header "User-Agent"]] contains "msie") || !([string tolower [HTTP::header "User-Agent"]] contains "trident") || [string tolower [HTTP::header "User-Agent"]] contains "mobile"}{
            HTTP::respond 302 Location "http://www.differentlocation.com"
        }
    }