Forum Discussion
Daniel_104050
Nimbostratus
Aug 29, 2012Need more redirect help
Sorry for the elementary questions, but I am new to F5 and have been thrown to the wolves so to speak. I need to find out how/if this can be done and searches aren't showing me what I am looking for, at least I don't think...so here goes
I need the below redirects to work in 1 irule on one VIP. Is this possible?
when HTTP_REQUEST {
if { [HTTP::host] equals "site/a"}{
HTTP::redirect "site/sites/a"}
}
if { [HTTP::host] equals "site/b"}{
HTTP::redirect "site/sites/b"}
}
4 Replies
- nitass
Employee
e.g.[root@ve10:Active] config b virtual bar list virtual bar { destination 172.28.19.79:80 ip protocol 6 rules myrule profiles { http {} tcp {} } } [root@ve10:Active] config b rule myrule list rule myrule { when HTTP_REQUEST { if {[HTTP::host] eq "site"} { switch [string tolower [HTTP::uri]] { "/a" { HTTP::redirect "http://[HTTP::host]/sites/a" } "/b" { HTTP::redirect "http://[HTTP::host]/sites/b" } default { do something } } } } } [root@ve10:Active] config curl -I http://172.28.19.79/a -H "Host: site" HTTP/1.0 302 Found Location: http://site/sites/a Server: BigIP Connection: Keep-Alive Content-Length: 0 [root@ve10:Active] config curl -I http://172.28.19.79/b -H "Host: site" HTTP/1.0 302 Found Location: http://site/sites/b Server: BigIP Connection: Keep-Alive Content-Length: 0 - Daniel_104050
Nimbostratus
thank you but I am having some problems getting this to work. This is what I have in my irule. When the user hits the site sharepoint goes and retrieves the site from the database. I want to do a re-write, not a redirect I think. This way it actully sends the url string.
when HTTP_REQUEST {
if {[HTTP::host] eq "site"} {
switch [string tolower [HTTP::uri]] {
"/a" { HTTP::redirect "http://[HTTP::host]/sites/a" }
"/b" { HTTP::redirect "http://[HTTP::host]/sites/b" }
default {
do something
}
}
} - Daniel_104050
Nimbostratus
thank you but I am having some problems getting this to work. This is what I have in my irule. When the user hits the site sharepoint goes and retrieves the site from the database. I want to do a re-write, not a redirect I think. This way it actully sends the url string.
when HTTP_REQUEST {
if {[HTTP::host] eq "site"} {
switch [string tolower [HTTP::uri]] {
"/a" { HTTP::redirect "http://[HTTP::host]/sites/a" }
"/b" { HTTP::redirect "http://[HTTP::host]/sites/b" }
default {
do something
}
}
} - Daniel_21056
Nimbostratus
I am unable to get the rule to work. I am not even sure why since it is seemingly such an easy rule
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