Forum Discussion
Will_Petersen_9
Nimbostratus
Aug 29, 2006XML Redirect via iRule
Trying to determine how I can post an XML document to the client if both of the servers fail. In our case when the client sends a request we respond back with an XML document containing a url link. Based on what I read this is what i came up with but I am not sure
when HTTP_RESPONSE {
if { [HTTP::status] contains "404"} {
HTTP::payload replace 1 0
{
http://www.hireright.com
}
}
}
- Jason_Roppolo_3Historic F5 AccountI am not sure about replacing the payload, but you can try doing something like this:
- Will_Petersen_9
Nimbostratus
I got this to work just using when HTTP_REQUEST but when I added the if statement it didn't work. It should be checking whether a node is up and if it is down provide my XML page. Both nodes in the pool referenced are down as I took them down to test - Deb_Allen_18Historic F5 AccountTry removing the "$" preceding the poolname, IP address and port. The $ are only needed to indicate a variable reference. Either
orif { [LB::status pool pool_mip_test member 192.168.26.88 80] eq "down" }{
will work.set myPool pool_mip_test set myIP 192.168.26.88 set myPort 80 if { [LB::status pool $myPool member $myIP $myPort] eq "down" }{
- Deb_Allen_18Historic F5 Account(edited above for typos)
- bl0ndie_127134Historic F5 AccountYou know the saying 'when you have a BigIP in you hand, every thing looks like iRules' ....
- Deb_Allen_18Historic F5 AccountI suppose I should also have pointed out that you wouldn't get a syntax error, but there will be runtime errors like this in the LTM Local Traffic log: Aug 31 12:42:01 tmm tmm[1077]: 01220001:3: TCL error: can't read "ip": no such variable while executing "log local0. "0000 init $ip""/deb
- Will_Petersen_9
Nimbostratus
I tried the LB_FAILED as so - bl0ndie_127134Historic F5 AccountIf the LB_FAILED event did fire then you are probably running into the bug that I talked about. In such case, your best bet is to set the fallback host via rule or http profile to point to the page with the XML response. Some SOAP clients don't understand 302 Redirects. In those cases, you will have to resort to your original rule.
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