Forum Discussion

Eireann78_19953's avatar
Eireann78_19953
Icon for Nimbostratus rankNimbostratus
Nov 09, 2008

Fallback host plus http_response iRule

On a virtual server http profile I am re-directing to a friendly server-error page which still responds with a 500 status code.

 

This works fine and re-directs no problem.

 

 

profile http http-test-ivip {

 

defaults from http

 

fallback "http://www.test.com/server-error"

 

fallback status "500"

 

 

I also have a friendly 404 page which I added a simple iRule for using http_response.

 

 

when HTTP_RESPONSE {

 

if { [HTTP::status] == 404} {

 

HTTP::redirect "http://www.test.com/pagenotfound"

 

}

 

}

 

 

This works fine in isolation but when both are enabled at the same time the 500 fallback breaks. I logged the following error when I try to trigger the 500.

 

 

Nov 9 16:44:06 tmm tmm[1728]: 01220001:3: TCL error: handle404.test.iRule - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::status"

 

 

Is it possible to nest these in an iRule?

 

 

Any help much appreciated,

 

D.

 

 

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Are you just trying to combine the two with a pair of redirects? If so then you just need to mirror the logic you have for the 404 status checking and change the redirect location. skottieb brings up a good point as well, there is an HTTP::fallback command - Click here - that you could use instead of specifying the fallback host in the profile. That would likely get you where you're trying to go as well.

     

     

    Colin