Forum Discussion
VFB
Cirrus
Jan 06, 2016http header and uri redirect
Hello, I'm attempting to construct an iRule that looks at a header and URI, then performs a redirect if they match. This is what I've attempted but unsuccessful. I have multiple redirects based on di...
Kai_Wilke
MVP
Jan 06, 2016Hi VFB,
could it be that you wanna parse the HOST-header for a given site name and then apply some redirects based on the a given URI? If so then this code would do the trick...
when HTTP_REQUEST {
switch -exact -- [string tolower [HTTP::host]] "www.yahoo.com" {
switch -exact -- [string tolower [HTTP::uri]] "/news" - "/weather" {
HTTP::redirect "https://www.yahoo.com/login.aspx=0"
} default {
do nothing
}
} "www.google.com" {
switch -exact -- [string tolower [HTTP::uri]] "/news" - "/weather" {
HTTP::redirect "https://www.google.com/login.aspx=0"
} default {
do nothing
}
} default {
do nothing
}
}BTW: If not, then elaborate some additional details on the "header" you want to parse.
Cheers, Kai
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
