Forum Discussion
Eireann78_19953
Nimbostratus
Nov 09, 2008Fallback 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.
- Scott_85521
Nimbostratus
Maybe try HTTP::fallback instead - Colin_Walker_12Historic F5 AccountAre 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.
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects