Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

Proxy

Vaytl
Posts: 28
Joined: Tue Jan 04, 2022 12:52 pm

Proxy

Post by Vaytl »

Hello.
Can you please tell me how to set up a proxy server for the browser?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

The current version of WebView2 doesn't allow you to set the proxy settings so we have to use the Chromium command line switches.

GlobalWebView2Loader.ProxySettings is used to add these command line switches :
  • if GlobalWebView2Loader.ProxySettings.NoProxyServer is TRUE then "--no-proxy-server" is added.
  • if GlobalWebView2Loader.ProxySettings.AutoDetect is TRUE then "--proxy-auto-detect" is added.
  • if you set some value to GlobalWebView2Loader.ProxySettings.Server then "--proxy-server" is added with that value.
  • if you set some value to GlobalWebView2Loader.ProxySettings.ByPassList then "--proxy-bypass-list" is added with that value.
  • if you set some value to GlobalWebView2Loader.ProxySettings.PacUrl then "--proxy-pac-url" is added with that value.
Read these documents for more information about those command line switches :
https://www.chromium.org/developers/design-documents/network-settings#TOC-Command-line-options-for-proxy-sett
https://www.linuxbabe.com/desktop-linux/configure-proxy-chromium-google-chrome-command-line
Vaytl
Posts: 28
Joined: Tue Jan 04, 2022 12:52 pm

Re: Proxy

Post by Vaytl »

Thanks Salvadordf.
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

Please download WebView4Delphi again from GitHub.

I just fixed an issue assigning values to the proxy settings.
Vaytl
Posts: 28
Joined: Tue Jan 04, 2022 12:52 pm

Re: Proxy

Post by Vaytl »

salvadordf wrote: Fri Jan 14, 2022 8:49 am I just fixed an issue assigning values to the proxy settings.
Thank you.
It was possible to set the proxy server only during initialization.
It didn't work after initialization.
Maybe I'm doing something wrong?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

WebView2 has more limitations than CEF and at this moment we can't do that.
We can only configure it with a proxy before the GlobalWebView2Loader.StartWebView2 call.
Vaytl
Posts: 28
Joined: Tue Jan 04, 2022 12:52 pm

Re: Proxy

Post by Vaytl »

Thank you very much, Salvadordf
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: Proxy

Post by pushca »

Is there a chance in the future to make authorization support for a proxy?
User avatar
salvadordf
Posts: 4620
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: Proxy

Post by salvadordf »

Try adding the username and password to the URL in the GlobalWebView2Loader.ProxySettings.Server property :

Code: Select all

http://<user>:<pass>@<host>:<port>/
pushca
Posts: 37
Joined: Sat Dec 04, 2021 5:09 pm

Re: Proxy

Post by pushca »

I'm still trying to find a way. Unfortunately, this line didn't help me. Maybe there are more ideas? I even tried to send messages via SendMessage to Webbrowser1.RenderCompHWND, but it doesn't notice any messages other than the click.
Post Reply