cancel
Showing results for 
Search instead for 
Did you mean: 

Redirect domains to another domain with exclusion in URI

Dipx
Nimbostratus
Nimbostratus

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.

 

 

2 REPLIES 2

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 /

Dipx
Nimbostratus
Nimbostratus

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]} }