Forum Discussion
superd_88943
Dec 10, 2015Nimbostratus
iRule re-direct & Exclusions
Hi all,
Im hoping some guidance on creation of an iRule to redirect some traffic, as follows:
If URL request contains http://www.domain1.com/ redirect requests to http://domain2.domain.com/...
Kai_Wilke
Dec 10, 2015MVP
Hi Superd,
use this technique if you want to exclude just "some" URIs (not more than 10)
when HTTP_REQUEST {
if { [HTTP::host] eq "www.domain.de" } then {
set low_uri [string tolower [HTTP::uri]]
if { ( $low_uri equals "/researcharchive.asp?uk%20economy%20watch" ) or
( $low_uri equals "/researcharchive.asp?uk%20economy%20presentations" ) or
( $low_uri contains "/researcharchive2.asp" )
} then {
Do nothing
} else {
HTTP::redirect "http://domain2.domain.com/economic-research-unit"
}
}
}
Use this technique if you want to exclude a bunch of URIs (more than 10 but not more than 50)
when HTTP_REQUEST {
if { [HTTP::host] eq "www.domain.de" } then {
switch -glob -- [string tolower [HTTP::uri]] "/somedummypath/" - \
"/researcharchive.asp?uk%20economy%20watch" - \
"/researcharchive.asp?uk%20economy%20watch2" - \
"/researcharchive.asp?uk%20economy%20watch3" - \
"/researcharchive.asp?uk%20economy%20watch4" - \
"/researcharchive.asp?uk%20economy%20presentations" - \
"/researcharchive.asp?uk%20economy%20summary*" - \
"/researcharchive2.asp?*" - \
"/some_wildcard_path/*" - \
"/some_explicit_path/" - \
"/favicon.ico" {
Do nothing
} default {
HTTP::redirect "http://domain2.domain.com/economic-research-unit"
}
}
}
Use this technique if you want to exclude a lot of URIs (more than 50)
Remark: You have to configure the "EXEMPTED_URIs" in a seperated Datagroup. See https://support.f5.com/kb/en-us/products/big-ip_ltm/manuals/product/bigip-system-irules-concepts-11-6-0/6.html for further information.
when HTTP_REQUEST {
if { [HTTP::host] eq "www.domain.de" } then {
if { [class match [string tolower [HTTP::uri]] starts_with EXEMPTED_URIs ] } then {
Do nothing
} else {
HTTP::redirect "http://domain2.domain.com/economic-research-unit"
}
}
}
Cheers, Kai
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