Forum Discussion
Manuel_Rodrigu2
Nimbostratus
Jun 25, 2008Redirect to a different folder hosted by a different pool
Hi there,
Hope this can be done with an iRule. Basically when I receive requests for http://www.abc.com/hello I need to redirect them to http://www.abc.com/hello_1 hosted on a different pool, not the default.
Is it possible with an iRule?
Thanks
Manuel
- The_Bhattman
Nimbostratus
Hi Manual,when HTTP_REQUEST { if {HTTP::uri eq "hello" } { HTTP::redirect "http://www.abc.com/hello_1" } }
- Manuel_Rodrigu2
Nimbostratus
Hi cmbhatt, - Jose_Santiago_O
Nimbostratus
Hi Manuel,when HTTP_REQUEST { if {[string tolower [HTTP::uri]] equals "/hello" } { HTTP::uri "/hello_1" pool my_other_pool } else { pool my_default_pool } }
- Deb_Allen_18Historic F5 AccountIt's not clear whether you want to redirect or re-write the URI. josantia's solution re-writes the URI, but only for exactly that URI.
when HTTP_REQUEST { if {[getfield [string tolower [HTTP::uri]] "/" 2] equals "hello" } { HTTP::uri [string map {"/hello" "/hello_1"} [HTTP::uri]] pool my_other_pool } else { pool my_default_pool } }
when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "/hello1*" { pool my_other_pool } "/hello*" { HTTP::redirect "http://[HTTP::host]/hello_1[substr [HTTP:uri] 6]" } default { pool my_default_pool } } }
- Deb_Allen_18Historic F5 AccountOops, sorry, that first example doesn't work since the first directory is a substring. of the 2nd. Adjusted to extract the first directory name with getfield instead of using starts_with
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