Forum Discussion
Brian_Ott_11267
Nimbostratus
Dec 06, 2004http::payload
Can I use http:payload to evaluate the data sent to the client and then cause an action?
Such as, the client is sent a busy page, but instead of being sent the busy page the f5 box catches that it is a busy page and resends the request to another server in the pool.
such as:
when HTTP_REQUEST {
if {[HTTP::payload] contains "busy.gif"} {
}
}
I imagine its not that easy, since this isn't quite working. I am not familar with what http::payload returns, so I am not sure what to check for, nor if HTTP_REQUEST is the right action to trigger on.
Any information or help would be appreciated.
-Brian.
4 Replies
- bl0ndie_127134Historic F5 AccountWith iRules you can inspect both the content and the status code to determine if you need to re-write the response to the client.
Do you have the ability to configure your web server to return a ‘503 Service Unavailable’ instead of the ‘sorry’ page? If yes, then I think you are better off checking the response status code rather than digging the content to see if there is an error. Here is an example of a rule that redirects based on a bad status code.when HTTP_RESPONSE { if {[HTTP::status] >= 500} { HTTP::redirect “http://www.sorry-server.com” } } - Brian_Ott_11267
Nimbostratus
I can look into whether we can do that, but can you perhaps give me a sample of how to look at the content?
would http::payload be appropriate?
Our application is specialized and I suspect sending a status code is not yet feasible. The uri sent is talking directly to our code and the error provided is customized so status codes are probably not going to work.
Any help would be very much appreciated. - bl0ndie_127134Historic F5 AccountHere is an example for inspecting the content.
when HTTP_RESPONSE { Collect data for inspection set clen [HTTP::header Content-Length] if {$clen > 0} { HTTP::collect $clen } } when HTTP_RESPONSE_DATA { Check for ‘sorry’ data in the payload set found [string first “sorry.gif” [HTTP::payload $clen] ] Redirect if {$found != -1 } { HTTP::redirect “http://www.sorry-server.com” } } - Brian_Ott_11267
Nimbostratus
Thank you!
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
