Forum Discussion
Wasim_Hassan_13
Nimbostratus
Nov 20, 2014Multiple Websites on Single VIP
Hi,
I have multiple websites which are currently on Microsoft TMG. I want to migrate them to F5. There are multiple URLS hosted on different servers which are running on different ports as well...
Brad_Parker_139
Nacreous
Nov 21, 2014I just noticed you wanted to account for www in your HTTP-HTTPS redirect so here's an update example for that irule:
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] starts_with "www."}{
set host [string range [HTTP::host] 4 end]
}
else {
set host [HTTP::host]
}
set my_loc "https://$host[HTTP::uri]"
TCP::respond "HTTP/1.1 301 Moved Permanently\r\nLocation: $my_loc\r\nConnection: close\r\nContent-Length: 0\r\n\r\n"
TCP::close
}
The irule for the pool selection on your HTTPS VIP could look something like this:
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"site1.test.com" {
pool site1_pool
}
"site2.test.com" {
pool site2_pool
}
"site3.test.com" {
pool site3_pool
}
default {
pool default_pool
}
}
}
Hope this helps.
Brad_Parker_139
Nacreous
Nov 21, 2014One irule, the top one, for your HTTP VIP to handle to redirects(including accounting for www adn redirecting without it) and one iRule, the second one on the HTTPS VIP for pool selection.
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