Forum Discussion
one rewrite url works and another does not.
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.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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