cancel
Showing results for 
Search instead for 
Did you mean: 

TrafficScript that uses Traffic IP as the variable

SOLVED
dyoung_1
Occasional Contributor

TrafficScript that uses Traffic IP as the variable

We currently have a web application in our environment that we wish to have a single pool of servers for, with separate TIP's for Internal and External users. 

We want the users who hit the internal TIP to be directed to

app1.xyz.com/passthroughauthentication.htm

We want users that hit the external TIP to go to

app1.zyx.com/formsbasedauthentication.htm

I am unable to see a way to do a IF/Then with traffic script that uses the Traffic IP as the qualifier, any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
dnahas
Contributor

Re: TrafficScript that uses Traffic IP as the variable

See the request.getLocalIP() function, Returns the IP address that the client connected to, i.e. the address local to this machine.


if( request.getLocalIP() == "10.0.0.1" ){


   http.redirect( "app1.xyz.com/passthroughauthentication.htm" );


}


   else {


   http.redirect( "app1.zyx.com/formsbasedauthentication.htm" );


}



View solution in original post

2 REPLIES 2
subhuman
New Contributor

Re: TrafficScript that uses Traffic IP as the variable

Depends on how your client handles a HTTP redirect.

One way would to be bind each Traffic IP to its own Virtual Server, then use a trafficscript as appropriate on each VS ie, for the internal one:


http.redirect( "http://app1.xyz.com/passthroughauthentication.htm" );


If you don't like the idea of using two Virtual Servers you could look at string.ipmaskmatch - ie, check wether the source IP address is in a private address space. Only works if your 'internal' clients use private addresses.

There are other things you can do, such as have pools for specific nodes which only handle specific types of authentication and switch between the pools as required depending on the source - a bit more involved to set up though.

dnahas
Contributor

Re: TrafficScript that uses Traffic IP as the variable

See the request.getLocalIP() function, Returns the IP address that the client connected to, i.e. the address local to this machine.


if( request.getLocalIP() == "10.0.0.1" ){


   http.redirect( "app1.xyz.com/passthroughauthentication.htm" );


}


   else {


   http.redirect( "app1.zyx.com/formsbasedauthentication.htm" );


}