01-Aug-2021 04:30
Hello,
I'm new to f5 technologies, I would need help to create an iRule for the below requirements.
Client requests to web1.com should redirect to web2.com ( Web2.com is on different environment )
Client request for some URI, such as web1.com/feedback and web1.com/about should not redirect.
Can anyone help me to create an iRule for the above requirement.
01-Aug-2021
09:13
- last edited on
04-Jun-2023
19:21
by
JimmyPackets
Hi Dipx,
Create a datagruop and add the excluded URIs.
Change the datagroup name in the below iRule.
when HTTP_REQUEST {
if { [HTTP::host] equals "web1.com" && not [class_match [string tolower [HTTP::uri]] starts_with datagroupname] } {
HTTP::redirect https://web2.com[HTTP::uri]
}
}
You can use equals or start_with as per your need.
Datagroup strings must start with /
03-Aug-2021
02:23
- last edited on
04-Jun-2023
19:21
by
JimmyPackets
Hello Enes,
It worked, but slight changes required.
However, rule is not working Chrome browser
when HTTP_REQUEST {
if { [HTTP::host] equals "web1.com" && not [matchclass [string tolower [HTTP::uri]] contains zatca_redirect_exception] } {
HTTP::redirect https://web2.com[HTTP::uri]}
}