Forum Discussion

Bayan_El_Ameen1's avatar
Bayan_El_Ameen1
Icon for Nimbostratus rankNimbostratus
Oct 04, 2011

Redirection iRule on ASM Blocking

Hello,

 

 

I need an iRule to redirect to home page when the ASM blocks a request.

 

 

I know that this can be achieved by selecting a redirect url for the response page instead of using the default response page but I need something more general for I have multiple applications and I want to manage that in an iRule.

 

 

I have tried the following iRule but it's not working:

 

 

when ASM_REQUEST_BLOCKING {

 

HTTP::redirect https://[HTTP::host]/

 

}

 

 

Thanks,

 

 

Bayan El Ameen

 

 

 

 

22 Replies

  • since i have changed my irule to this:

    when ASM_REQUEST_VIOLATION {
     get violation informations
     set x [ASM::violation_data]
     set vio [lindex $x 0]
     set uri [HTTP::uri]
    set host [HTTP::host]
    
    }
    
    when ASM_REQUEST_BLOCKING {
     get violation informationsand set defaults
    set x [ASM::violation_data]
    set vio [lindex $x 0]
    
     switch through violation events
    switch $vio {
    "VIOLATION_OBJ_DOESNT_EXIST" -
    "VIOLATION_METACHAR_IN_OBJ" {
    log local0. "www.host.de --> Blocking $vio (illegal URL), uri=$uri, host=$host"
    
     redirect without Server Header to requested host/index.asp
    HTTP::respond 302 noserver Location "http://$host/index.asp"
    
    }
    
    }
    
    }

    i got an additional error message:

    http_process_state_prepend - Invalid action EV_TCL_CLOSE during ST_HTTP_PREPEND_HEADERS

    so i will open a case...
  • update:

     

    the message "Invalid action EV_INGRESS_DATA during ST_HTTP_PREPEND_HEADERS" is still a bug.

     

    the recommandation from support is:

     

    don't use the line HTTP::respond 302 noserver Location "$url" @ when ASM_REQUEST_VIOLATION { }

     

    perhaps, it will be fixed in a future release.