I'd like to be able to redirect http requests from fiddler code through upstream proxys, which I want to be able to specify at runtime.
I've looked through FiddlerApplication
functions, and I don't see anything that might fit, as well as I haven't found anything matching in the documentation (except that you might specify a startup flag to use system's proxy as upstream proxy).
What is the best way to specify/change fiddler core proxy at runtime?
Fiddler changes your proxy settings on startup and reverts them back to what they were before you started when Fiddler is closed.
By default, Fiddler Everywhere "chains" to the default proxy of the system. The Gateway settings allow you to override that behavior. (Recommended) Use system proxy—The default selection. Fiddler uses the OS system proxy.
If your enterprise contains numerous internal branches, an upstream proxy can bundle the requests from the internal network before passing the traffic on to the external network/internet. This page allows you to configure an upstream proxy for IPv4/IPv6.
If you want to send each request to a proxy, and that proxy isn't the system's default: Before each request is sent, specify the X-OverrideGateway flag on the Session. Inside your BeforeRequest handler, add the following line:
oSession["X-OverrideGateway"] = "someProxy:1234";
-Eric
As EricLaw have said in his answer that you have to specify X-OverrideGateway flag on the Session, although if you want to do a basic HTTP authentication to the upstream proxy, you can set the credentials by adding the Proxy-Authorization header to the session inside your BeforeRequest handler like that
string userCredentials = string.Format("{0}:{1}", "user", "password");
string base64UserCredentials = Convert.ToBase64String(Encoding.UTF8.GetBytes(userCredentials));
oSession.RequestHeaders["Proxy-Authorization"] = "Basic " + base64UserCredentials;
Here's a list of the HTTP header fields https://en.wikipedia.org/wiki/List_of_HTTP_header_fields
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With