Forum Discussion
bwilliam
Cirrus
Dec 03, 2015irule To Redirect A Specific Network Going To a URL
I have an office in India and need to send any request from that network for site.domain.com to local.domain.com. If the network is not equal India_Host_Networks then hit site.domain.com. I think I h...
StephanManthey
Nacreous
Dec 04, 2015It would look like the following to stick to your example with the string "media" contained in the hostname:
}
"*media*" {
if { [class match [IP::client_addr] equals India_Host_Networks] } {
HTTP::redirect " https://InhydNimble1.domain.com[HTTP::uri]"
return
} else {
HTTP::redirect " https://media.domain.com[HTTP::uri]"
return
}
}
"*change*" {
HTTP::redirect "http://site.domain.com/cm"
return
}
"*empcon*" {
HTTP::redirect "http://site.domain.com/?cmd=login"
return
}
"*im*" {
HTTP::redirect "https://site.domain.com/IntegratedLogin.asp"
return
}
By adding the
[HTTP::uri]
to the redirect you will preserve the initial path including variables.
There is no need for an additional hostname evaluation. So I removed it.
(It will be evaluated by the switch command and match the "*media*" as you are using the globbing option.) 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