hostname redirect for public IPs only

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

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

Thank you Enes, it works fine.