Forum Discussion
minnoce944
Nimbostratus
Jul 30, 2014http rewrite and pool selection based on method
We have a requirement to perform URI rewrites for specific paths and direct that request to the appropriate pool. As an added bonus we also need to inspect the http method used to make sure we are se...
Arie
Altostratus
Jul 31, 2014I can't test it right now, but try this:
when HTTP_REQUEST {
if {( [string tolower [HTTP::uri]] eq "/IMSWeb/IMSServlet" ) } {
HTTP::uri "/ReservationService/IMSServlet"
pool pool1.tcp.8780
}
check to determine appropriate method, perform switch statement
if { [string tolower [HTTP::method]] eq "get" } {
method is get, need to rewrite URI and route to appropriate pool
switch -glob [string tolower [HTTP::uri] ] {
"/IMSWeb/rest/services/inventory" {
HTTP::uri "/ReservationService/IMSServlet"
pool pool1.tcp.8780
}
"/IMSWeb/Lookup" {
HTTP::uri "/ReservationService/UI/invLookUp"
pool pool1.tcp.8780
}
}
}
else { [string tolower [HTTP::method]] eq "put" } {
method is put, need to rewrite host & URI and route to appropriate pool
switch -glob [string tolower [HTTP::uri] ] {
"/IMSWeb/rest/services/item" {
HTTP::host "foo.com"
HTTP::uri "/iasserver/rest/services/item"
pool pool2.tcp.80
}
"/IMSWeb/rest/services/inventory" {
HTTP::host "foo.com"
HTTP::uri "/iasserver/rest/services/inventory"
pool pool2.tcp.80
}
}
}
}
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