Forum Discussion

uhuru187_324247's avatar
uhuru187_324247
Icon for Nimbostratus rankNimbostratus
Jun 14, 2017

irules

Could you please advise if this syntax for irules is correct? This is for a page redirect.

 

when HTTP_RESPONSE { if { [HTTP::status] contains "404" or [HTTP::status] contains "410" or [HTTP::status] contains "500" or [HTTP::status] contains "503"} { HTTP::redirect "; } }

 

5 Replies

  • eben's avatar
    eben
    Icon for Nimbostratus rankNimbostratus

    It could be, but you are better of using a DataGroup List. You can create a type String.

    when HTTP_RESPONSE {
    if {[class match [HTTP::status] contains 
    
    
    }
    HTH
    eben.
    • cjunior's avatar
      cjunior
      Icon for Nacreous rankNacreous

      eben,

       

      This way it will work, but is not it bad to implement to this simple verification?

       

      Respectfully,

       

  • It could be, but you are better of using a DataGroup List. You can create a type String.

    when HTTP_RESPONSE {
    if {[class match [HTTP::status] contains 
    
    
    }
    HTH
    eben.
    • cjunior's avatar
      cjunior
      Icon for Nacreous rankNacreous

      eben,

       

      This way it will work, but is not it bad to implement to this simple verification?

       

      Respectfully,

       

  • Hello uhuru187,

     

    I'd prefer to do this:

     

    when HTTP_RESPONSE { 
        if { [HTTP::status] == 404 || [HTTP::status] == 410 || [HTTP::status] == 500 || [HTTP::status] == 503 } { 
            HTTP::redirect "https://thiswebsite.com"; 
        } 
    }
    

    Since "[HTTP::status]" returns a HTTP code and check with "equals" operator.

     

    Regards.