Forum Discussion
No HTTP to HTTPS redirection for VPN traffic on basis on client source address also add responed to url if URI not contain any word
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
5 Replies
- Kevin_Stewart
Employee
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" } } - sdagar_194989
Nimbostratus
i tried below irule but not working - sdagar_194989
Nimbostratus
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]" }
}
- Kevin_Stewart
Employee
Okay, so a few comments:
-
You don't need to set all of those variables since you're not using them
-
You don't need to capture the default pool and use the pool command if that's what is configured in the VIP's properties. You're better off not doing pool management from the iRule if you can help it. Having the pool assigned to the VIP, with a appropriate monitor will affect the state of the VIP itself (if for example you're using GTM upstream). If you don't apply the pool to the VIP and you're doing the pool management in an iRule, then a failed pool will not change the state of the VIP.
-
In your code, if a VPN client is accessing the HTTP VIP and not asking for "/", they'll be redirected to the HTTPS VIP fom the else condition. I'm guessing that's not what you want.
-
- sdagar_194989
Nimbostratus
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
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com