Forum Discussion
Michael_Yates
Nimbostratus
Jan 22, 2008HTTP Request rewrite before sending to specified node
I'm trying to make an iRule that will enable website testing on different specified nodes. Because most of the website that need to be testing in this way are URL dependent I wanted to do the testing by adding to the URL, and having the F5 remove the URL additions before sending the traffic to the specific node.
Something like this, but this doesn't rewrite the URL properly before sending the traffic to the node and fails with "node1" not found.
when HTTP_REQUEST {
if { [HTTP::uri] starts_with "/node1" } {
set newpath [findstr [HTTP::uri] "node1" 5]
node 192.168.1.1 8080
}
if { [HTTP::uri] starts_with "/node2" } {
set newpath [findstr [HTTP::uri] "node2" 5]
node 192.168.1.2 8080
} else {
pool $myPool
}
}
What I need is the following:
http://foo.website.com/node1
Then have the F5 strip out the "/node1" and send http://foo.website.com to the specified node.
Any help or is greatly appreciated.
2 Replies
Sort By
- hoolio
Cirrostratus
If this is the method you want to try, below is a rule which should do it.when HTTP_REQUEST { switch -glob [HTTP::path] { /node1/* { Remove the /node1 prefix from the path HTTP::path [string map {/node1 ""} [HTTP::path]] Set the node node 192.168.1.1 8080 } /node2/* { Remove the /node1/ prefix from the path HTTP::path [string map {/node2 ""} [HTTP::path]] Set the node node 192.168.1.2 8080 } default { Take some default action? pool http_pool } } }
- Michael_Yates
Nimbostratus
Just wanted to let everyone know that it worked.
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