Forum Discussion
iRule HTTP_RESPONSE event not kicking in
Here is my scenario:
- IIS Server
- IIS Site (Serves my site)
- an iRule on the aboe IIS Site Virtual Server
- The iRule has following events: HTTP_INIT, HTTP_REQUEST, HTTP_RESPONSE
When the IIS site is running, all of the above three events kick in and I can see the logs. Ofcourse the HTTP_INIT will run one time.
When the IIS site is not running (Intentionaly stopped for testing) only HTTP_REQUEST runs but I do not see HTTP_RESPONSE kicking in.
I was expecting the HTTP_RESPONSE to kick-in.
Any thoughts from the forum members?
9 Replies
- Kevin_Stewart
Employee
That is exactly as expected. Both HTTP events are triggered after the headers are consumed. So HTTP_REQUEST fires after the client request headers are received, and HTTP_RESPONSE fires after the server response headers are received. No response, no event.
- Rajesh_A_142089
Nimbostratus
Kevin, thanks for the clarification.
Then my next questions is, is there an event to track when the server does not send the headers?
Bottom line is I want to identify when server does not respond so that I can send user to an alternative page.
- Kevin_Stewart
Employee
Best practice is going to be an intelligent health monitor applied to the pool so this doesn't happen. There's always the possibility that a server can fail between monitor "pings", but to detect that might be more work than just letting the monitor remove the server from the pool.
- Rajesh_A_142089
Nimbostratus
Sure, we have monitors in place to take out the member from the pool.
And if the entire Pool is down then I have when LB_FAILED event as well.
But the need for me to perform this from an iRule is still there, such that if https://mydomain/mysite/mypage.aspx does not respond, then I want to send to https://myotherdomain/mysite/mypage.aspx.
Please advise.
- nitass
Employee
But the need for me to perform this from an iRule is still there, such that if https://mydomain/mysite/mypage.aspx does not respond, then I want to send to https://myotherdomain/mysite/mypage.aspx.
after wiki (More Examples: send response from BigIP if server does not respond within a specified amount of time)
https://devcentral.f5.com/wiki/iRules.after.ashx- Rajesh_A_142089
Nimbostratus
Nitass, Thanks for the reply. Good alternative. But I think determining a delay will be challanging since this sould would be deployed to several server farms with varying scale and response time. I will keep evaluting this...
- nitass_89166
Noctilucent
But the need for me to perform this from an iRule is still there, such that if https://mydomain/mysite/mypage.aspx does not respond, then I want to send to https://myotherdomain/mysite/mypage.aspx.
after wiki (More Examples: send response from BigIP if server does not respond within a specified amount of time)
https://devcentral.f5.com/wiki/iRules.after.ashx- Rajesh_A_142089
Nimbostratus
Nitass, Thanks for the reply. Good alternative. But I think determining a delay will be challanging since this sould would be deployed to several server farms with varying scale and response time. I will keep evaluting this...
- Kevin_Stewart
Employee
While it's certainly a workable idea, I'd hesitate to use the after command, given that it has the potential to consume extra memory and that you'd be using it on every HTTP response. I think you might do well here with an inband monitor and an iRule like this:
when CLIENT_ACCEPTED { set def_pool [LB::server pool] set lb_fails 0 } when LB_FAILED { log local0. "lb failed" if { $lb_fails < [active_members $def_pool] } { LB::mode rr LB::reselect pool $def_pool } else { log local0. "no servers available" HTTP::redirect "http://www.google.com" } incr lb_fails }You'd normally combine this with an active monitor that proactively removes failed members from the pool, while the inband monitor and iRule waits some predetermined amount of time for a response before triggering an LB_FAILED event.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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