An API for adding custom browser proxy bypass rules

Made a cool mod to CEF that you'd like to share with others? Discuss CEF modifications here, and view modifications that others have made.

An API for adding custom browser proxy bypass rules

Postby mihait » Thu Mar 21, 2013 5:02 am

When a system proxy is set, loading an html file from localhost (assuming a local web server is up) via LoadURL actually dispatches the localhost address through the proxy, resulting in the webpage not being displayed.
Currently, I have a workaround for this problem which implies adding a Chromium patch in the net third party project, namely, I've added a proxy rule for local addresses to bypass the system proxy configuration.
However, from a first look, the browser proxy settings are also accessible at browser creation time (cef3/libcef/browser/browser_main.cc#100) so I was wondering, what's your opinion about adding a method that could set custom proxy rules? It would certaintly solve this problem in a much cleaner way than adding modifications to the net project and it would also eliminate the need of maintaing the custom patch.
mihait
Newbie
 
Posts: 8
Joined: Thu Feb 21, 2013 8:37 am

Re: An API for adding custom browser proxy bypass rules

Postby magreenblatt » Thu Mar 21, 2013 9:45 am

You can set proxy settings via the command line: http://dev.chromium.org/developers/desi ... y-settings. See the section about proxy bypass list.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: An API for adding custom browser proxy bypass rules

Postby mihait » Thu Mar 21, 2013 10:22 am

I remember I tried this when actually doing the fix for a CEF1 embedding app a while ago and it didn't seem to work. I'll try this solution with CEF3, hopefully we won't have the same problems here, nevertheless, thanks a lot for the suggestion!
mihait
Newbie
 
Posts: 8
Joined: Thu Feb 21, 2013 8:37 am

Re: An API for adding custom browser proxy bypass rules

Postby magreenblatt » Thu Mar 21, 2013 10:41 am

mihait wrote:I remember I tried this when actually doing the fix for a CEF1 embedding app a while ago and it didn't seem to work. I'll try this solution with CEF3, hopefully we won't have the same problems here, nevertheless, thanks a lot for the suggestion!

These command line flags are not implemented in CEF1 so that will definitely make a difference ;-).
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: An API for adding custom browser proxy bypass rules

Postby mihait » Thu Mar 21, 2013 11:19 am

Sadly, I've tested the --proxy-bypass-list with CEF3, and as the docs state, it only has effect when specifying a custom proxy via the --proxy-server flag. This means that unfortunately, it won't solve our problem, since we would like to use the system proxy, but only bypass it for <local> addresses.
mihait
Newbie
 
Posts: 8
Joined: Thu Feb 21, 2013 8:37 am

Re: An API for adding custom browser proxy bypass rules

Postby magreenblatt » Thu Mar 21, 2013 11:43 am

mihait wrote:Sadly, I've tested the --proxy-bypass-list with CEF3, and as the docs state, it only has effect when specifying a custom proxy via the --proxy-server flag. This means that unfortunately, it won't solve our problem, since we would like to use the system proxy, but only bypass it for <local> addresses.

Ah, sorry, I didn't inspect the docs closely enough to see that requirement. If you're only using localhost (and don't need external proxy-resolved resources) then you could use the "--no-proxy-server" flag.

How does Chrome behave? Do you have an entry for localhost in your HOSTS file (assuming Windows)? I'm somewhat surprised that localhost requests are sent to the proxy.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: An API for adding custom browser proxy bypass rules

Postby fddima » Thu Mar 21, 2013 12:01 pm

magreenblatt wrote:How does Chrome behave? Do you have an entry for localhost in your HOSTS file (assuming Windows)? I'm somewhat surprised that localhost requests are sent to the proxy.

Default Windows 7 configuration did not have localhost entry in hosts file (they are commented out).
Code: Select all
# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   ::1             localhost
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: An API for adding custom browser proxy bypass rules

Postby mihait » Mon Mar 25, 2013 1:24 am

By default, the proxy bypass lists on both mac and win (I haven't tested linux) don't include an entry for localhost. This means that Chromium aswell as CEF dispatch localhost requests through the proxy.
Regarding the --no-proxy flag, unfortunately, it wouldn't be an option, as I'd also like to load some external resources in the CEF view.
mihait
Newbie
 
Posts: 8
Joined: Thu Feb 21, 2013 8:37 am

Re: An API for adding custom browser proxy bypass rules

Postby magreenblatt » Thu Mar 28, 2013 10:09 am

Is this only for local testing or are you planning to develop a product that uses a local web server? If it's only for local testing then editing your HOSTS file should be an option. If you're developing a product you might want to consider using a custom scheme handler or CefRequestHandler::GetResourceHandler() to avoid any issues loading local resources.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: An API for adding custom browser proxy bypass rules

Postby mihait » Thu Mar 28, 2013 11:17 am

The change is intended for a product that loads files from a local server, as well as from some remote resources, so adding the localhost entry isn't probably an option.
Adding a custom scheme handler doesn't sound so clear, could you please provide more info on this?
mihait
Newbie
 
Posts: 8
Joined: Thu Feb 21, 2013 8:37 am

Next

Return to Modifications Forum

Who is online

Users browsing this forum: No registered users and 12 guests