Last active
June 6, 2022 17:13
-
-
Save BobbyWibowo/57cc470c870893087c9e30a9c34ae536 to your computer and use it in GitHub Desktop.
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
import System; | |
import Fiddler; | |
class Handlers | |
{ | |
static const SERVER_HOST: String = "localhost"; // WSL2 must use exact local IP (ip addr list eth0) | |
static const DISPATCH_SERVER_PORT: Int32 = 42069; | |
static const UPSTREAM: Array = [ | |
".yuanshen.com", | |
".hoyoverse.com", | |
".mihoyo.com" | |
]; | |
static function OnBeforeRequest(oSession: Session) { | |
for (var i = 0; i < UPSTREAM.length; i++) { | |
if (oSession.host.ToLower().Contains(UPSTREAM[i])) { | |
// oSession.oRequest.headers.Add("X-Full-URL", oSession.fullUrl); | |
oSession.host = SERVER_HOST; | |
if (DISPATCH_SERVER_PORT) { | |
oSession.port = DISPATCH_SERVER_PORT; | |
} | |
return; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment