Title: RequestHandler to set Proxy Auth not working · Issue #29 · cefsharp/CefSharp.OutOfProcess · GitHub
Open Graph Title: RequestHandler to set Proxy Auth not working · Issue #29 · cefsharp/CefSharp.OutOfProcess
X Title: RequestHandler to set Proxy Auth not working · Issue #29 · cefsharp/CefSharp.OutOfProcess
Description: for the classes: public class CustomRequestContext : RequestContextHandler { public WebProxy CurrentProxy { get; set; } public bool blockWebRTC { get; set; } = true; public CustomRequestContext(bool blockRTC) : base() { blockWebRTC = blo...
Open Graph Description: for the classes: public class CustomRequestContext : RequestContextHandler { public WebProxy CurrentProxy { get; set; } public bool blockWebRTC { get; set; } = true; public CustomRequestContext(boo...
X Description: for the classes: public class CustomRequestContext : RequestContextHandler { public WebProxy CurrentProxy { get; set; } public bool blockWebRTC { get; set; } = true; public CustomRequestContext(boo...
Opengraph URL: https://github.com/cefsharp/CefSharp.OutOfProcess/issues/29
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RequestHandler to set Proxy Auth not working","articleBody":"for the classes:\n```\npublic class CustomRequestContext : RequestContextHandler\n{\n\n public WebProxy CurrentProxy { get; set; }\n public bool blockWebRTC { get; set; } = true;\n public CustomRequestContext(bool blockRTC) : base()\n {\n blockWebRTC = blockRTC;\n\n \n }\n protected override async void OnRequestContextInitialized(IRequestContext requestContext)\n {\n requestContext.SetPreference(\"credentials_enable_service\", true, out _);\n if (CurrentProxy != null)\n {\n requestContext.SetPreference(\"webrtc.multiple_routes_enabled\", false, out _);\n requestContext.SetPreference(\"webrtc.nonproxied_udp_enabled\", false, out _);\n if (blockWebRTC)\n requestContext.SetPreference(\"webrtc.ip_handling_policy\", \"disable_non_proxied_udp\", out _);\n\n requestContext.SetProxy(CurrentProxy.Address.Scheme, CurrentProxy.Address.Host, CurrentProxy.Address.Port, out string error);\n requestContext.SetPreference(\"intl.accept_languages\", \"en-US,en;q=0.9,en\", out string error2);\n }\n }\n\n protected override IResourceRequestHandler GetResourceRequestHandler(IBrowser browser, IFrame frame, IRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling)\n {\n return base.GetResourceRequestHandler(browser, frame, request, isNavigation, isDownload, requestInitiator, ref disableDefaultHandling);\n }\n\n\n}\n\npublic class ProxyAuthRequestHandler : CefSharp.Handler.RequestHandler\n{\n public NetworkCredential Credentials { get; set; }\n protected override bool GetAuthCredentials(IWebBrowser chromiumWebBrowser, IBrowser browser, string originUrl, bool isProxy, string host, int port, string realm, string scheme, IAuthCallback callback)\n {\n File.WriteAllText(@$\"D:\\html\\{DateTime.Now.Ticks}.json\", $@\"{new { originUrl , isProxy , host , port, realm , scheme }}\");\n\n if (Credentials != null && isProxy == true)\n {\n callback.Continue(Credentials.UserName, Credentials.Password);\n return true;\n }\n return false;\n }\n}\n```\n\nand calling in file ` BrowserProcessHandler.cs.cs` in the method `CreateBrowser`\n\n```\n Task IOutOfProcessClientRpc.CreateBrowser(IntPtr parentHwnd, string url, int id)\n {\n //Debugger.Break();\n\n return CefThread.ExecuteOnUiThread(() =>\n {\n var requestContextSettings = new RequestContext(new CustomRequestContext( false) { CurrentProxy = this.Proxy });\n var browser = new OutOfProcessChromiumWebBrowser(_outOfProcessServer, id, url, requestContextSettings);\n browser.RequestHandler = new ProxyAuthRequestHandler() { Credentials = (NetworkCredential)Proxy.Credentials };\n var windowInfo = new WindowInfo();\n windowInfo.WindowName = \"BrowserProcess\";\n windowInfo.SetAsChild(parentHwnd);\n //Disable Window activation by default\n //https://bitbucket.org/chromiumembedded/cef/issues/1856/branch-2526-cef-activates-browser-window\n windowInfo.ExStyle |= OutOfProcessChromiumWebBrowser.WS_EX_NOACTIVATE;\n browser.CreateBrowser(windowInfo);\n _browsers.TryAdd(id, browser);\n\n return true;\n });\n }\n\n```\nCustomRequestContext is set and the proxy is done but it promps as is show in the image for a proxy credentials the GetAuthCredentials method is never called. on non auth proxies it works all fine cause CustomRequestContext sets correctly the proxy.\n\u003cimg width=\"576\" height=\"374\" alt=\"Image\" src=\"https://github.com/user-attachments/assets/83a6e08c-1268-4bea-99fe-fd6c4792dba0\" />\n\nprobably I'm missing something on my understanding of the project but I'm unable to make the Request Handler to work.","author":{"url":"https://github.com/SorceryAdmin","@type":"Person","name":"SorceryAdmin"},"datePublished":"2025-10-21T19:34:37Z","url":"https://github.com/cefsharp/CefSharp.OutOfProcess/issues/29"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:aa3ffbe2-b2c7-761b-6561-ce6eeb199c34 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9BB0:F4E6A:1594BA7:1CEE19C:6AFEBCBD |
| html-safe-nonce | 7df9eec33040018b968186ef8a50980f4adfda7ec76c95b9bf718a3b2808365a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QkIwOkY0RTZBOjE1OTRCQTc6MUNFRTE5Qzo2QUZFQkNCRCIsInZpc2l0b3JfaWQiOiI2MjIzNzUxNDUxNjAwOTI3OTMzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 53140427222011480277a9a775aa1b463d3f48909e0bf1b993c356ef9fb6518e |
| hovercard-subject-tag | issue:3537924733 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/cefsharp/CefSharp.OutOfProcess/29/issue_layout |
| twitter:image | https://opengraph.githubassets.com/a9fc7a0f73724f1a7bce8a66d04523f353eea94fd4221954b992405b48e7acfe/cefsharp/CefSharp.OutOfProcess/issues/29 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/a9fc7a0f73724f1a7bce8a66d04523f353eea94fd4221954b992405b48e7acfe/cefsharp/CefSharp.OutOfProcess/issues/29 |
| og:image:alt | for the classes: public class CustomRequestContext : RequestContextHandler { public WebProxy CurrentProxy { get; set; } public bool blockWebRTC { get; set; } = true; public CustomRequestContext(boo... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | SorceryAdmin |
| hostname | github.com |
| expected-hostname | github.com |
| None | 95b2753c978240785d6cca00783c00a371b2d7d9879bb32e305170a1b19bd28e |
| turbo-cache-control | no-preview |
| go-import | github.com/cefsharp/CefSharp.OutOfProcess git https://github.com/cefsharp/CefSharp.OutOfProcess.git |
| octolytics-dimension-user_id | 5076038 |
| octolytics-dimension-user_login | cefsharp |
| octolytics-dimension-repository_id | 500235408 |
| octolytics-dimension-repository_nwo | cefsharp/CefSharp.OutOfProcess |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 500235408 |
| octolytics-dimension-repository_network_root_nwo | cefsharp/CefSharp.OutOfProcess |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | e1ce4c46d35aa8463a597a1bbffd4f0a456edb38 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width