Forum Discussion
Chris_14167
Nimbostratus
Jan 29, 2010Content level routing question
Hi - I am very new to writing iRules, and right now we are using an iRule to perform a phased migration from one legacy system to a new server. Both answer on port 80. We are inspecting URI, and also looking for a string in the content of the packet to decide which pool to send the traffic to.
The issue I am having is that these servers support multiple URIs, and one specific URI appears not to work. The only thing we've found is that the server is sending it's data as HTTP 1.1, and all of the other servers that use this VS are using HTTP 1.0.
Troubleshooting steps have been to remove the content inspection rules and only route on URI. When we do that, it sends it to the correct pool. When we reintroduce the [HTTP::payload] inspection, the iRule works, but doesn't route properly.
Here is the iRule that we are using (uri's changed to protect the innocent):
when HTTP_REQUEST {
set uri [HTTP::uri]
set string1 "10000"
set string2 "20000"
set string3 "25000"
if { ($uri contains "/b2bgate") and ([HTTP::payload] contains $string1)} then {
pool gateway-prod
} elseif {
($uri contains "/b2bgate") and ([HTTP::payload] contains $string2)} then {
pool gateway-prod
} elseif {
($uri contains "/b2bgate") and ([HTTP::payload] contains $string3)} then {
pool gateway-prod
} else {
pool gateway-old
}
}
It looks like the F5 can't inspect the payload of the packet. What am I missing?
Thanks,
Chris.
2 Replies
- The_Bhattman
Nimbostratus
- hoolio
Cirrostratus
Hi Chris,
When you call HTTP::payload from the HTTP_REQUEST event, only the portion of the HTTP payload in the first TCP packet is available, but the full payload (which could be in multiple packets) is not available. If you want to do pool selection based on HTTP payload content, you'd need to use HTTP::collect to buffer the full payload and do the inspection/pool selection in the HTTP_REQUEST_DATA event.
For details you can check the HTTP::collect wiki page:
http://devcentral.f5.com/wiki/default.aspx/iRules/http__collect
Note that the pool command isn't listed as a valid command in the HTTP_REQUEST_DATA event, but I think this is an omission on the wiki page--not an actual limitation.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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