Forum Discussion
hkatzler_36651
Nimbostratus
Jul 23, 2009http redirect with using different pools
Hello,
i need an iRule to redirect http requests. I have to use different pools for diffrent redirects.
Sample:
http://keyaccount.company.com should redirect to http://keyaccount.othercompany.net/path/path/index.html and use pool 1 for the redirect.
http://marketing.company.com should redirect to http://marketing.anothercompany.org/path/path/index.html and use pool 2 for the redirect.
when HTTP_REQUEST {
if { [HTTP::host] contains "keyaccount.company.com" } {
HTTP::redirect "http://keyaccount.othercompany.net/path/path/index.html"
This redirect should use pool 1. But how can i do this?
} elseif { [HTTP::host] contains "marketing.company.com" } {
HTTP::redirect "http://marketing.anothercompany.org/path/path/index.html"
This redirect should use pool 2. And so on.....
}
}
I hope, someone can help me. Thank you for response!
Heiko
5 Replies
Sort By
- hoolio
Cirrostratus
Hi Heiko,when HTTP_REQUEST { switch [string tolower [HTTP::host]] { "keyaccount.company.com" { Rewrite / to /path/path/index.html if {[HTTP::path] eq "/"}{ HTTP::uri "/path/path/index.html" } Rewrite host header to keyaccount.othercompany.com HTTP::header replace Host "keyaccount.othercompany.com" Use pool1 pool pool1 } "keyaccount.company.com" { Rewrite / to /path/path/index.html if {[HTTP::path] eq "/"}{ HTTP::uri "/path/path/index.html" } Rewrite host header to keyaccount.othercompany.com HTTP::header replace Host "keyaccount.othercompany.com" Use pool1 pool pool1 } default { Take some default action for other host header values? } } }
- hkatzler_36651
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Rewriting a URI would mean that LTM changes the requested host and/or URI before sending the request to the pool. The client would not see the change to the request as long as the application doesn't include the rewritten host and/or URI in response headers/content. For HTTP, the term redirecting the client denotes sending a 30x response with the Location header set to the new location. The client would see the change in host and/or URI. If the host was changed in a redirect, the client would resolve the new host value to an IP address and make a new HTTP request to that host. - WUM_113639
Nimbostratus
Hi Aaron, - hoolio
Cirrostratus
Hi Wum,
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