Forum Discussion
ShakN_167332
Nimbostratus
Aug 20, 2014I want to Redirect multiple Sites in a single Irule. please help me with the irule command.
I have mulitple sites where i want my LAN users should not to redirected to https when they use url with http. but when any internet users use http://abc.com than it should redirect to https://abc.co...
Yann_Desmarest_
Nacreous
Aug 24, 2014Maybe you can try this
when HTTP_REQUEST {
if { [HTTP::host] equals "asites.abc.com" } {
switch -glob [HTTP::uri] {
"/xyz/finance" -
"/xyz/site2" -
"/xyz/site3" -
"/xyz/site4" -
"/xyz/site5" {
HTTP::redirect "http://asites.internet.abc.com[string map -nocase [list "/xyz/finance" "/sites/finance" "/xyz/test" "/sites/test"] [HTTP::uri]]"
}
default {}
}
}
You can also use datagroup to achieve what you want
when HTTP_REQUEST {
if { [HTTP::host] equals "asites.abc.com" } {
if { class match [HTTP::uri] equals mydatagroup } {
HTTP::redirect "http://asites.internet.abc.com[class lookup [HTTP::uri] mydatagroup]"
}
}
}
where datagroup of type string contains "/xyz/finance" with value "/sites/finance"
ShakN_167332
Nimbostratus
Aug 25, 2014i get the below error when i try to create the data group which you suggested in irule.
01070151:3: Rule [test] error: line 3: [parse error: PARSE syntax 104 {syntax error in expression " class match [HTTP::uri] equals test ": variable references require preceding $}] [{ class match [HTTP::uri] equals test }]
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