Technical Forum
Ask questions. Discover Answers.
cancel
Showing results for 
Search instead for 
Did you mean: 
Custom Alert Banner

hostname redirect for public IPs only

iRule
Cirrus
Cirrus

Dear Community,

I am using following iRule to redirect traffic to another virtual IP during maintenance window but this iRule causes all traffic of external internet clinets with "public IPs" & internal clients inside our organization with "private IPs" as well to be redirected to maintenance page. 

==========================

when HTTP_REQUEST {
if { [HTTP::host] contains "morning.abc.com" } {
HTTP::redirect "https://evening.xyz.com/en/contact-us/mobile/maintenance"
}
}

=====================

Kindly proivde an updated iRule which should redirect requests originating only from external internet clinets with "public IPs" to maintenance page & internal clients inside our organization with "private IPs" should not be redirected to https://evening.xyz.com/en/contact-us/mobile/maintenance

 

Best Regards

@LTM @iRule @ADC  @Application Delivery

1 ACCEPTED SOLUTION

Hi,

when HTTP_REQUEST {
	if { [HTTP::host] eq "morning.abc.com" && not ([class match [IP::client_addr] equals /Common/private_net]) } {
		HTTP::redirect "https://evening.xyz.com/en/contact-us/mobile/maintenance"
		return
	}
}

https://support.f5.com/csp/article/K19509439

View solution in original post

2 REPLIES 2

Hi,

when HTTP_REQUEST {
	if { [HTTP::host] eq "morning.abc.com" && not ([class match [IP::client_addr] equals /Common/private_net]) } {
		HTTP::redirect "https://evening.xyz.com/en/contact-us/mobile/maintenance"
		return
	}
}

https://support.f5.com/csp/article/K19509439

iRule
Cirrus
Cirrus

Thank you Enes, it works fine.