Forum Discussion
minnoce944
Jul 31, 2014Nimbostratus
I changed else to elseif and http::host to http::header replace Host since i'm on ver 11.4. It compiles fine now. I'll post back after my testing results.
Below is updated version:
first uri check to determine if it matches
method can be get or put, rewrite URI and route to appropriate pool
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
}
}
}
elseif { [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::header replace Host "pool2"
HTTP::uri "/iasserver/rest/services/item"
pool pool2.tcp.80
}
"/IMSWeb/rest/services/inventory" {
HTTP::header replace Host "pool2"
HTTP::uri "/iasserver/rest/services/inventory"
pool pool2.tcp.80
}
}
}
}