justcoding121 / titanium-web-proxy

A cross-platform asynchronous HTTP(S) proxy server in C#.
MIT License
1.92k stars 598 forks source link

How to interrupt localhost traffic? #915

Open ljh1991125 opened 2 years ago

ljh1991125 commented 2 years ago

Hi.

I am using Titanium Proxy 3.1.1397. Generally it works very well. But there is one problem. If it is localhost traffic, the proxy does not seem to be able to handle it. For example, if i type http://localhost/index.php, it is not detected by Proxy's OnRequest Callback. I need to redirect localhost traffic to server.

This is my source code.

                proxyServer.BeforeRequest += OnRequest;
                proxyServer.BeforeResponse += OnResponse;
                proxyServer.ServerCertificateValidationCallback += OnCertificateValidation;
                proxyServer.ClientCertificateSelectionCallback += OnCertificateSelection;
                proxyServer.EnableTcpServerConnectionPrefetch = false;
                proxyServer.EnableConnectionPool = false;

                explicitEndPoint = new ExplicitProxyEndPoint(IPAddress.Any, 8000, true)
                {

                };

Thank you for your help.

honfika commented 1 year ago

How do you set to use the proxy? Manually in your OS/broswer? Usualy you have to enable it for localhost separatly.

Enumix commented 1 year ago

I've made a comment in another thread which explains how to do it: https://github.com/justcoding121/titanium-web-proxy/issues/954#issuecomment-1509708306