Data group URIs matching & redirection to external sites
Hello All,
Can anyone help me with the following scenario?
- Use an i-rule and data group entries to match specific URIs, and redirect each customers to their corresponding external sites location.
- Add this logic to the existing iRule we are currently using.
- Is there any other better way to accomplish this beside an iRule? maybe Local Traffic Policy etc...We need to make it flexible and easy to
modify due to many entries.
Since there will be 50-100 URIs unique to each customer, We need to call on a data group with the entries from the irule so that
admins can safely add or remove URIs and their corresponding external site/locations in the future.
Example:
Customer 1 --> https://our-website.com/Customer1 ---> They need to be redirected to ---> https://marketing-site.com/Customer1/Product_info_1
Customer2--> https://our-website.com/Customer2 ---> They need to be redirected to ---> https://marketing-site.com/Customer2/Product_info_2
Customer 3 --> https://our-website.com/Customer3 ---> They need to be redirected to ---> https://marketing-site.com/Customer3/Product_info_3
##### Data group we need to create for a 1 to 1 matching for each customer. Each customers are different and will need
to be redirected to an external marketing site that contains their specific data...There will be 50-100 entries in this data group ####
ltm data-group internal DG-URI-MATCH-REDIRECT {
records {
/Customer1 {
data https://marketing-site.com/Customer1/Product_info_1
}
/Customer2 {
data https://marketing-site.com/Customer2/Product_info_2
}
/Customer3 {
data https://marketing-site.com/Customer3/Product_info_3
}
/Customer4{
data https://marketing-site.com/Customer4/Product_info_4
}
/Customer5 {
data https://marketing-site.com/Customer5/Product_info_5
}
}
type string
}
### Example of our Existing code we have tied to a web server VIP ####
when HTTP_REQUEST {
if { [active_members WEBSERVER-POOL1] < 1 } {
HTTP::redirect " http://maintenance-page.com"
} else {
set CHECK_IP [getfield [HTTP::header values X-Forwarded-For] " " 1]
if { !([class match $CHECK_IP eq DG-ALLOWED-IP]) } {
if { [class match [HTTP::uri] eq DG-URIS-LIST] } {
reject }
}
switch -glob [HTTP::uri] {
"*/sub1/link1*" -
"*/sub2/link2*" -
"*/sub3/link3*" {
if { ([class match $CHECK_IP eq DG-ALLOWED-IP]) } {
if { [HTTP::uri] contains "/ABC/123" } {
HTTP::redirect "https://[HTTP::host]/ABC/123"
} else {
HTTP::redirect "https://[HTTP::host]/Main/Login"
}
}
}
}
}
}
#######