Permalink
Cannot retrieve contributors at this time
Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign up
Fetching contributors…
| if( mapper.getServiceName( request ) == "sales" ) | |
| { | |
| var ipAddress = mapper.getBaggageItem( request, "forwarded-for" ); | |
| mapper.fine( 'Got IP Address as ' + ipAddress ); | |
| if( ipAddress ) | |
| { | |
| var lastDigit = ipAddress.substring( ipAddress.length - 1 ); | |
| mapper.fine( 'Got last digit as ' + lastDigit ); | |
| if( lastDigit % 2 == 0 ) | |
| { | |
| mapper.info( 'Rerouting to B instance for IP Address ' + ipAddress ); | |
| //Even IP address, reroute for A/B testing: | |
| hostAddress = mapper.getRoutedAddress( request, "http://sales2:8080" ); | |
| } | |
| } | |
| } |