28-Sep-2020
10:39
- last edited on
26-Jan-2023
13:29
by
JRahm
looking for some assistance with creating a irule to redirect on 2 parts of a url. If someone hits my f5 going to https://app123.mydomain111.com/pages/app123 I want them to be redirected to https://app456.mydomain111.com/pages/app789
can i just do...
when HTTP_REQUEST {
if { [HTTP::host] equals "app123.mydomain111.com " and [HTTP::uri] equals "/pages/app123" } {
HTTP::redirect "https://app456.mydomain111.com/pages/app789 "
}
}
will this work?
28-Sep-2020
19:30
- last edited on
26-Jan-2023
13:28
by
JRahm
I don't see any syntax issue & irule should work.
Would like to recommend irule which will work even though in upper case url.
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "app123.mydomain111.com" and [string tolower [HTTP::uri]] starts_with "/pages/app123" } {
HTTP::redirect "https://app456.mydomain111.com/pages/app789"
}
}
Thanks
29-Sep-2020 05:55
thank you i will give this a try.
06-Oct-2020 10:54
what if i want to wild card the directory on the source? so app123.mydomain111.com/*** redirect to app456.mydomain111.com/pages/app789
would i just remove the "and [string tolower [HTTP::uri]] starts_with "/pages/app123" }"?
15-Oct-2020 23:56
Yes... You can customise per requirements.