Forum Discussion
yaoxu_11146
Nimbostratus
Aug 01, 2008is it possible to write an iRule redirecting http requrest based on URI, but doesn't require http/fasthttp profile support?
we got a painful issue as describled in post http://devcentral.f5.com/Default.aspx?tabid=53&forumid=5&postid=26481&view=topic
In short, we need to do http request redirection based on URI,...
Andy_Herrman_22
Nimbostratus
Aug 04, 2008Try throwing some logging in place:
when CLIENT_ACCEPTED {
TCP::collect
}
when CLIENT_DATA {
set idx [string first " HTTP/1." [TCP::payload]]
if { $idx < 0 } {
if { [TCP::payload length] > 2048 } {
log local0. "ERROR! Could not find HTTP request in 2K! dropping..."
reject
} else {
Not enough data yet; collect more
TCP::collect
}
return
}
set request [string tolower [TCP::payload $idx]]
log local0. "Got request: $request"
if { $request contains " /XXXXX" } {
log local0. "Sending to Pool_XXXXX"
pool Pool_XXXXX
} else {
log local0. "Sending to Pool_WWWWW"
pool Pool_WWWWW
}
}
This will log the each request right before checking it, so you can see if it you're getting what you expect.
One thing that I can think of that might be happening: the request is made all lowercase, so make sure your " /XXXXX" value in the if statement is also all lowercase.
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