使用Titanium Web Proxy在C#中无法捕获特定API请求,但Fiddler Classic可正常捕获的问题求助
Titanium Web Proxy在C#中无法捕获特定API请求,但Fiddler Classic可正常捕获的问题求助
大家好,我最近在做一个需求:用C#结合Titanium Web Proxy拦截某个Windows应用的HTTP/HTTPS流量。目前我的程序已经在8888端口配置了显式代理,大部分HTTPS请求都能正常捕获到(比如login.live.com、events.data.microsoft.com这类地址的请求),但我需要监控的那个特定API的流量,完全不会出现在我的代理日志里。
更让我困惑的是,换用Fiddler Classic的话,就能正常看到这个API的请求和响应——这说明这个流量确实存在,而且不是那种无法被拦截的特殊加密方式。
下面是我当前使用的C#代码:
ProxyServer proxyServer = new ProxyServer(); proxyServer.CertificateManager.CreateRootCertificate(); proxyServer.CertificateManager.TrustRootCertificateAsAdmin(); proxyServer.CertificateManager.EnsureRootCertificate(); proxyServer.EnableConnectionPool = true; var explicitEndPoint = new ExplicitProxyEndPoint(System.Net.IPAddress.Any, 8888, true); proxyServer.AddEndPoint(explicitEndPoint); proxyServer.Start(); proxyServer.SetAsSystemHttpProxy(explicitEndPoint); proxyServer.SetAsSystemHttpsProxy(explicitEndPoint); proxyServer.BeforeRequest += OnRequest; proxyServer.BeforeResponse += OnResponse; private static async Task OnRequest(object sender, SessionEventArgs e) { Console.WriteLine($"[Request] {e.HttpClient.Request.Url}"); await Task.CompletedTask; } private static async Task OnResponse(object sender, SessionEventArgs e) { Console.WriteLine($"[Response] {e.HttpClient.Request.Url}"); await Task.CompletedTask; }
我已经确认系统代理设置确实指向了我的程序的8888端口,而且其他域名的流量都能正常捕获。有没有朋友遇到过类似的情况?或者能帮我排查一下可能的原因?比如是不是Titanium Web Proxy有什么默认的过滤规则?或者那个Windows应用的代理配置有特殊处理?
内容来源于stack exchange
相关产品推荐
相关产品推荐

