Forum Discussion
duffyj0_45477
Nimbostratus
Oct 20, 2010SOAP Response New to F5 - iRules
Is there a way to have an iRule to check 2 nodes in a pool, and that if they are both down. send this SOAP response?
HTTP/1.1 200 OK
Cache-Control: private
Content-length: 610 ...
hoolio
Cirrostratus
Oct 20, 2010Hi Duffy,
You can use HTTP::respond to send an LTM generated HTTP response.
http://devcentral.f5.com/wiki/default.aspx/iRules/http__respond
Here is an example:
HTTP::respond 200 content {http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. " } noserver Cache-Control private Content-Type {application/soap+xml; charset=utf-8} Server {Microsoft-IIS/7.5}
If you're on 9.4.1 or lower, you won't be able to use the noserver flag to suppress the LTM inserted "Server: BigIP" header in responses.
To check if the pool has no active members, you can use active_members:
when HTTP_REQUEST {
if {[active_members [LB::server pool]] == 0 }{
HTTP::respond 200 content \
{http://www.w3.org/2005/08/addressing/soap/fault urn:uuid:318bb7b9-8ca6-4f9c-a094-a82f82109fc1 s:Sender The application is temporarily down for maintenance. " } \
noserver \
Cache-Control private \
Content-Type {application/soap+xml; charset=utf-8} \
Server {Microsoft-IIS/7.5}
}
}
Aaron
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