dc_18986
Aug 30, 2007Historic F5 Account
My 1st iRule - How can I improve this?
Hello all,
Below is my 1st attempt at an iRule. A client of ours is replacing a Java servlet with an ASPX page. They want to the ability to process requests for the new service, while still handling requests for the old. They are phasing in this change gradually. I believe they need an iRule that detects a client connection, and 1) inspects tcp payload for a specific string (call to new service), and if found, redirects that traffic to the new service, url B) if upon inspection, the payload does not contain that string, redirect to old service, url A, which is an existing pool, providing the original service. Will something like the below work?
when CLIENT_ACCEPTED {
set port [80]
if { [TCP::local_port] == $port } {
TCP::collect 300
}
}
when CLIENT_DATA {
if { [TCP::payload] contains ""} {
log "Request For New XML Service Found. Sending to ASPX page."
HTTP::redirect urlB
}else {
log "Request Was for Old XML Service. Sending to Default xml Pool."
pool xml_pool
} else
}client_data