Forum Discussion
Lee_Sutcliffe
Aug 29, 2018Nacreous
You have an error in your code, [HTTP::header uri] will look for a header called 'uri', whereas I assume you mean HTTP::uri.
You are also checking for the same header twice so I've put it in one 'if' statement as well as adding a couple of lines of logging that may help troubleshooting. You also may want to consider using string tolower if this is accessed via a browser as URI is case sensitive. Please try the following.
when HTTP_REQUEST {
if {[HTTP::header "Host"] equals "intfilings.abc.gov"} {
if {[HTTP::uri] starts_with "/navigator_icm"} {
log local0. "replacing host on URI: [HTTP::uri]"
HTTP::header replace Host "server1.ct.gov"
} elseif {[HTTP::uri] starts_with "/EFilingWeb"} {
log local0. "replacing host on URI: [HTTP::uri]"
HTTP::header replace Host "server2.ct.gov"
}
}
}
You can also perform the same functionality using LTM Traffic Policies, these are recommended for simple iRules such as these.