Created
September 11, 2013 01:39
-
-
Save phm200/6518350 to your computer and use it in GitHub Desktop.
Fiddler Round Robin Load Balancing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public long numberOfRedirects = 1; | |
private string redirectHost = "192.168.100.57"; | |
private int hostPort = 9999; | |
private string destinationOne = "192.168.100.57"; | |
private int destOnePort = 8100; | |
private string destinationTwo = "192.168.100.57"; | |
private int destTwoPort = 8101; | |
public void AutoTamperRequestBefore(Session oSession) | |
{ | |
oSession.oRequest["RH-LookingFor"] = "Looking for hostname " + redirectHost + ":" + hostPort; | |
oSession.oRequest["RH-HostName"] = "HostName is " + oSession.hostname + ":" + oSession.port; | |
if (oSession.HostnameIs(redirectHost) && oSession.port == hostPort) | |
{ | |
if (numberOfRedirects % 2 == 0) | |
{ | |
oSession.hostname = destinationOne; | |
oSession.port = destOnePort; | |
} | |
else | |
{ | |
oSession.hostname = destinationTwo; | |
oSession.port = destTwoPort; | |
} | |
numberOfRedirects++; | |
if (numberOfRedirects > long.MaxValue - 10000) numberOfRedirects = 1; | |
oSession.oRequest["RH-Redirect"] = "Redirected to " + oSession.hostname + ":" + oSession.port; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment