Forum Discussion

Gorkalrp_105155's avatar
Gorkalrp_105155
Icon for Nimbostratus rankNimbostratus
Jun 18, 2015

Need help: iRules to allow only URIs

I would appreciate if some one could help me in create iRule/datagroup and applying iRule to allow only few URI's and remaining all should go to invalid page.

 

https://Ind-hyd.vidya.com/KURservlet/servlet/KURServlet https://Ind-hyd.vidya.com/KURservlet-stage/servlet/KURServlet https://Ind-hyd.vidya.com/KURservlet-test/servlet/KURServlet

 

All other request should be sent to the below error page: https://Ind-hyd.vidya.com/error/invalid.html

 

1 Reply

  • The previous irule must generate cyclic redirect as the else statement redirect to the same URL.

    the following irule must answer the need:

    when HTTP_REQUEST {
        switch -glob [string tolower [HTTP::path]] {
        switch -glob [HTTP::path] {
            "/KURservlet/servlet/KURServlet*" -
            "/KURservlet-stage/servlet/KURServlet*" -
            "/KURservlet-test/servlet/KURServlet*" {}
            default { HTTP::redirect noserver "https://Ind-hyd.vidya.com/error/invalid.html }
        }
    }
    

    The commented line is if you need to ignore the case. if you use this line, all conditions must be changed to lowercase.