Forum Discussion
Brandon_Van_849
Mar 05, 2012Nimbostratus
HTTP_Request and LB::Status
Im trying to use the HTTP_response 200 content from a IF statment made with LB::status. I have gotten the F5 to accept the irule with out error but i am still not getting the result i want. I want the f5 to intercept a request and feed out a custom message that i create based on the web pool being down. That is the rule i config'd however, for some reason all i get when services are down is the typical IE "page cannot be displayed". What is the problem?
- Brandon_Van_849Nimbostratusit is worth noting that the portal that user are trying to access are https, just fyi
- koenning_107182NimbostratusPosted By Brandon Van on 03/05/2012 08:26 AM
does that mean that you are terminating https on the F5 BIG-IP LTM ? If so, it should not matter. Would you be able to share the virtual server config and the irule with us ?
Thanks
Christian
- Brandon_Van_849Nimbostratuswhen HTTP_REQUEST {
- Brandon_Van_849Nimbostratusthe incoming requests are coming on https.
- hooleylistCirrostratusHi Brandon,
- koenning_107182NimbostratusHi Brandon,
when CLIENT_ACCEPTED { set def_pool [LB::server pool] set lb_fails 0 } when LB_FAILED { if { $lb_fails < [active_members $def_pool] } { LB::mode rr LB::reselect pool $def_pool } else { HTTP::respond 200 content { Apology Page We are sorry, but the site you are looking for is temporarily out of service If you feel you have reached this page in error, please try again. } } incr lb_fails }
- Brandon_Van_849Nimbostratushere is what we are trying to do. when we have to take down the system for maintenance we want to display a message, but we want to use the pool members as the IF statement instead of the http codes. there is only one web pool. and when services are stopped the pool status is red or down. would this work?
- koenning_107182NimbostratusThe following irule will achieve this:
The event CLIENT_ACCEPTED is only needed to get the pool name, and then it checks on LB_FAILED, if really no member is there, then it sends back the maintenance page. Alternatively this will work also if attached to HTTP_REQUEST, but that means the code will run on every request, while LB_FAILED will only run if the systems fails to select a pool member. see also https://devcentral.f5.com/wiki/iRules.lb_failed.ashxwhen CLIENT_ACCEPTED { set my_pool [LB::server pool] } when LB_FAILED { log local0. "[active_members $my_pool]" if { [active_members $my_pool] < 1 } { HTTP::respond 200 content { Apology Page We are sorry, but the site you are looking for is temporarily out of service If you feel you have reached this page in error, please try again. } } }
- Brandon_Van_849NimbostratusVery Good, Thanks For your help!
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