Forum Discussion
Annsar_Akhtar
Nimbostratus
Nov 26, 2015Irule query to redirect a uri on a new website
Hi All
I am looking at an irule to redirect a particular URI to a new site, if certain conditions are meet, i.e a user has a particular cookie set and except if the url contains particular langu...
Stanislas_Piro2
Cumulonimbus
Nov 26, 2015Hi,
Your irule had bad structure... you created two filters with the same URI...
can you try this irule:
when HTTP_REQUEST {
set uri [string tolower [HTTP::uri]]
store lang parameter, blank is not present
set lang [URI::query $uri lang]
if { [HTTP::cookie exists "NEWWEBSITE" ] && [HTTP::cookie value "NEWWEBSITE"] equals "1" } {
switch -glob $uri {
"/new-path/*" {
log local0. "cookie exists NEWWEBSITE and /new-path"
if { $lang equals "fr" || $lang equals "it" }{
log local0. "contains lang [HTTP::uri], pass to ORIGNAL-WEBSITE"
pool ORIGNAL-WEBSITE
}
}
"*/assets/scripts/*" -
"*/assets/styles/*" -
"*/assets/fonts/*" -
"*/media/*" {
log local0. "contains path [HTTP::uri], pass to NEW-WEBSITE pool" pool NEW-WEBSITE
log local0. "Pass to NEW-WEBSITE [HTTP::uri]"
}
default {
pool ORIGNAL-WEBSITE log local0. "pass to ORIGNAL-WEBSITE [HTTP::host][HTTP::uri]"
}
}
}
}
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