Forum Discussion

Chris_14167's avatar
Chris_14167
Icon for Nimbostratus rankNimbostratus
Jan 29, 2010

Content 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

  • 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