Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually set upstream proxy for fiddler core?

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?

like image 465
Arsen Zahray Avatar asked Jan 11 '13 18:01

Arsen Zahray


People also ask

Does Fiddler Change proxy settings?

Fiddler changes your proxy settings on startup and reverts them back to what they were before you started when Fiddler is closed.

What is the default proxy setting in Fiddler?

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.

What is an upstream 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.


2 Answers

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

like image 149
EricLaw Avatar answered Sep 23 '22 01:09

EricLaw


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

like image 27
Khaled El Kholy Avatar answered Sep 20 '22 01:09

Khaled El Kholy