Forum Discussion
Shridhar_84609
Nimbostratus
Aug 24, 2009Redirecting the URI
Hello,
I have a requirement to do the following -
http://abc.com/timesheets
should fetch the data from -
http://server1.com:30945/GroupServer/en/
...
hoolio
Cirrostratus
Aug 25, 2009Hi Shridhar,
LTM's virtual server and pool configuration will handle the server selection and port translation with the default settings. If you want to select server1 you could add it to its own pool timesheet_http_pool. For all other requests, you could create a second HTTP pool. The advantage to using two separate pools versus hardcoding the IP addresses in the iRule is that you can add new members to the pool or change the server by modifying the pool--not changing the iRule.
You could then use an iRule like this to select the pool and rewrite the requested URI:
when HTTP_REQUEST {
log local0. "[IP::client_addr]:[TCP::client_port]: "New [HTTP::method] request to [HTTP::host][HTTP::uri]"
Check if requested path starts with /timesheets
if {[HTTP::path] starts_with "/timesheets"}{
log local0. "[IP::client_addr]:[TCP::client_port]: Matched /timesheets check"
pool timesheets_http_pool
Rewrite path if path is exactly /timesheets
if {[HTTP::path eq "/timesheets"}{
Rewrite path
HTTP::path "/GroupServer/en"
log local0. "[IP::client_addr]:[TCP::client_port]: Rewriting path to /GroupServer/en"
}
} else {
Use default HTTP pool
pool default_http_pool
log local0. "[IP::client_addr]:[TCP::client_port]: Using default_http_pool"
Rewrite path if path is exactly /timesheets
if {[HTTP::path eq "/"}{
Rewrite path
HTTP::path "/primaveraweb"
log local0. "[IP::client_addr]:[TCP::client_port]: Rewriting path to /primaveraweb"
}
}
}
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