Requirment :No HTTP to HTTPS redirection for VPN traffic on basis on client source address also add respond to url if URI not contain any word.
In our setup there are 2 VIP’s configured with same public IP ,one is HTTP and other is HTTPS ,all traffic redirected towards HTTPS using policy. Now requirement is : If VPN traffic come there would no redirection required to HTTPS ,secondly URL should have response page like client.test.net/xx/yy ,means if VPN client hit page http://client.test.net the response page required would be http://client.test.net/xx/yy
and if internet client hit http://client.test.net the response page required would be https://client.test.net/xx/yy
Assuming you can uniquely identify the VPN clients by their lease pool source addresses, you could create an address-based datagroup that contains this subnet. The following iRule would be used in the HTTP VIP:
when HTTP_REQUEST {
if { [class match [IP::client_addr] equals my_vpn_datagroup] } {
if { [HTTP::uri] equals "/" } {
HTTP::redirect "http://client.test.net/xx/yy"
}
} else {
HTTP::redirect "https://client.test.net/xx/yy"
}
}
i tried below irule but not working
when HTTP_REQUEST { set base_pool [LB::server pool] set uri [HTTP::uri] set data_group [HTTP::host]
if { ( [IP::addr [IP::client_addr] equals 10.10.10.10/29 ] ) and ($uri equals "/" ) }
{ pool $base_pool HTTP::respond 301 Location “http://test.check.net/xx/yy” return
} else { HTTP::redirect “https://[HTTP::host][HTTP::uri]” }
}
Thank Kevin for your response .. 1.we are not using pool for HTTP VIP 2.if traffic coming from Internet it should be redirected towards HTTPS VIP 3.if URI “/” contains the respond page should be like http://client.test.net/xx/yy for VPN traffic but internet traffic redirected to HTTP as there is another irule configured which will response according to different URI