Forum Discussion
Carolyn_Robert_
Nimbostratus
Dec 12, 2006Redirecting to a pool
I'm confused about how to use redirects and pooling.
Here's my situation:
> DNS entry "www.abcd.com" is pointed at my virtual server "gateway"
> VS "gateway" uses pool "PROD", tha...
hoolio
Cirrostratus
Dec 13, 2006I don't think it will work to select the pool and redirect in the same shot.
If you have HTTP and HTTPS virtual servers that www.abcd.com points to, you could redirect all clients to https://www.abcd.com. Then on the HTTPS virtual server you could rewrite the Host header to the host name of the selected node.
You could use this rule on the HTTP virtual server to redirect from HTTP to HTTPS:
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri]
}For the HTTPS VIP, you would need to assign a client SSL and HTTP profile. You could then use the following rule as an example to rewrite the host header after the node has been selected, but before the request is sent to the node.
when LB_SELECTED {
if { [IP::addr [LB::server addr] equals 10.0.0.10] }{
HTTP::header replace Host "new_http_host_header.example.com"
log local0. "Replaced host header with value 1"
}
elseif {[IP::addr [LB::server addr] equals 10.0.0.20] }{
HTTP::header replace Host "second_new_http_host_header.example.com"
log local0. "Replaced host header with value 2"
}
else {
take some default action?
pool default_pool
log local0. "Took some default action"
}
}I haven't tested this but in concept it should work. If you run into problems/errors, check the /var/log/ltm log file for the entries and repost if you need any help.
You can check the LB::server page on the wiki for more details on the related LB::server (Click here) and IP::addr commands (Click here)
Aaron
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