monkeyWie / proxyee

HTTP proxy server,support HTTPS&websocket.MITM impl,intercept and tamper HTTPS traffic.
MIT License
1.52k stars 567 forks source link

proxy to proxy with authent #119

Closed smichea closed 3 years ago

smichea commented 3 years ago

I would like to use proxyee to be able to use third parties proxy that use authentication when the client can only provide the proxy info through some query params (say proxy_host, proxy_port, proxy_login, proxy_pass)

For instance using proxyee as a proxy while querying https://github.com?proxy_host=1.2.3.4&proxy_port=8080&proxy_login=mylogin&proxy_pass=mypass , proxyee would then send a get https://github.com to the host 1.2.3.4:8080 setting some basic authent header using the login and pass.

I see how i could use FullRequestIntercept.handleRequest to read and remove the query param and set the header for authentication, but how can get the scheme and host in order to add it as a prefix of the uri ? Also how can i change the host and port of the request ?

Thank you for your work.

monkeyWie commented 3 years ago

Hello, you can take a look at this sample code: https://github.com/monkeyWie/proxyee/blob/master/src/test/java/com/github/monkeywie/proxyee/InterceptForwardHttpProxyServer.java#L37-L39

The argument pipeline can get and change scheme and host.

smichea commented 3 years ago

Thank You !