Forum Discussion
I want to Redirect multiple Sites in a single Irule. please help me with the irule command.
this is my irule and applied on vs 443. my /bseu to /sites redirection works first time and next time onwords redirection is not happening.
when RULE_INIT { set static::asitesext "asites.abc.com" set static::asitesint "asites.internet.abc.com" set static::aportalext "aportal.abc.com" set static::aportalint "aportal.internet.abc.com" set static::amyext "amy.abc.com" set static::amyint "amy.internet.abc.com" set static::aextranetext "aextranet.abc.com" set static::aextranetint "aextranet.internet.abc.com" set static::awww "awww.abc.com" } when HTTP_REQUEST { if {[class match [IP::client_addr] equals InternalHosts]} {
HTTP::redirect http://[HTTP::host][HTTP::uri] } else { log local0. "Incoming URI = [HTTP::uri]" if { [string tolower [HTTP::uri]] starts_with "/bseu" } { if { [string tolower [HTTP::uri]] equals "/bseu" or [string tolower [HTTP::uri]] starts_with "/bseu/it" } { set uri [HTTP::uri] } else { set uri [string map -nocase {"/bseu" "/sites"} [HTTP::uri]] } log local0. "New URI = $uri" HTTP::uri $uri } switch -glob -- [string tolower [HTTP::host]] {
"asites.abc.com"
{
HTTP::header replace Host $static::asitesint
STREAM::disable
}
"awww.abc.com"
{
HTTP::redirect https://aportal.abc.com
STREAM::disable
}
"aportal.abc.com"
{
HTTP::header replace Host $static::aportalint
STREAM::disable
}
"amy.abc.com"
{
HTTP::header replace Host $static::amyint
STREAM::disable
}
"aextranet.abc.com"
{
HTTP::header replace Host $static::aextranetint
STREAM::disable
}
}
} } when HTTP_RESPONSE { if {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::asitesint}{ HTTP::header replace Location [string map "$static::asitesint $static::asitesext" [HTTP::header Location]] STREAM::enable } elseif {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::aportalint}{ HTTP::header replace Location [string map "$static::aportalint $static::aportalext" [HTTP::header Location]] STREAM::enable } elseif {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::amyint}{ HTTP::header replace Location [string map "$static::amyint $static::amyext" [HTTP::header Location]] STREAM::enable } elseif {[HTTP::is_redirect] && [string tolower [HTTP::header "Location"]] contains $static::aextranetint}{ HTTP::header replace Location [string map "$static::aextranetint $static::aextranetext" [HTTP::header Location]] STREAM::enable } }
- StephanMantheySep 01, 2014
Nacreous
Could you please provide the log output by running the following command while testing: tail -f /var/log/ltm - ShakN_167332Sep 02, 2014
Nimbostratus
please find the below output of the log tail -f/var/log/ltm [admin@xyz:Active] ~ tail -f /var/log/ltm | grep test Sep 2 10:37:39 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/finance Sep 2 10:37:39 local/tmm info tmm[4924]: Rule test : New URI = /bseu/finance Sep 2 10:38:13 local/tmm info tmm[4924]: Rule test : Incoming URI = /favicon.ico Sep 2 10:38:23 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/hr Sep 2 10:38:23 local/tmm info tmm[4924]: Rule test : New URI = /bseu/hr Sep 2 10:38:31 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/it Sep 2 10:38:31 local/tmm info tmm[4924]: Rule test : New URI = /bseu/it Sep 2 10:39:08 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/bd Sep 2 10:39:08 local/tmm info tmm[4924]: Rule test : New URI = /bseu/bd Sep 2 10:39:21 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/rd Sep 2 10:39:21 local/tmm info tmm[4924]: Rule test : New URI = /bseu/rd Sep 2 10:39:54 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/procurement Sep 2 10:39:54 local/tmm info tmm[4924]: Rule test : New URI = /bseu/procurement Sep 2 10:40:03 local/tmm info tmm[4924]: Rule test : Incoming URI = /bseu/markets Sep 2 10:40:03 local/tmm info tmm[4924]: Rule test : New URI = /bseu/markets - ShakN_167332Sep 04, 2014
Nimbostratus
Can any one give me alternative code for my requirement.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* 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