Irule query to redirect a uri on a new website
Hi All
I am looking at an irule to redirect a particular URI to a new site, if certain conditions are meet, i.e a user has a particular cookie set and except if the url contains particular language (defined in the uri i.e lang=fr).
I have most of the irule working but need some pointers as I am running into an issue as the redirect to the new site is working but their are absolute paths on the new pages which I am struggling to capture in the same rule.
Below is the starting point irule so any pointers or suggestions welcome, I suspect its due to using an if as this is only triggering for /new-path/ and the other uris are then ignored:
when HTTP_REQUEST { if { [HTTP::cookie exists "NEWWEBSITE" ] && [HTTP::cookie value "NEWWEBSITE"] equals "1" && [string tolower [HTTP::uri]] starts_with "/new-path/" } { log local0. "cookie exists NEWWEBSITE and /new-path" if {[string tolower [HTTP::uri]] contains "lang=fr" || [string tolower [HTTP::uri]] contains "lang=it" }{ log local0. "contains lang [HTTP::uri], pass to ORIGNAL-WEBSITE" pool ORIGNAL-WEBSITE } else { if {[string tolower [HTTP::uri]] starts_with "/new-path/" || [string tolower [HTTP::uri]] contains "/assets/scripts/" || [string tolower [HTTP::uri]] contains "/assets/styles/" || [string tolower [HTTP::uri]] contains "/assets/fonts/" || [string tolower [HTTP::uri]] contains "/media/" }{ log local0. "contains path [HTTP::uri], pass to NEW-WEBSITE pool" pool NEW-WEBSITE log local0. "Pass to NEW-WEBSITE [HTTP::uri]" } else { pool ORIGNAL-WEBSITE log local0. "pass to ORIGNAL-WEBSITE [HTTP::host][HTTP::uri]" } } } }
Thanks in advance