Skip to content

Instantly share code, notes, and snippets.

@BobbyWibowo
Last active June 6, 2022 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save BobbyWibowo/57cc470c870893087c9e30a9c34ae536 to your computer and use it in GitHub Desktop.
Save BobbyWibowo/57cc470c870893087c9e30a9c34ae536 to your computer and use it in GitHub Desktop.
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