Supporting proxies?

2,214 views
Skip to first unread message

brad...@roboticprofit.com

unread,
Jan 4, 2017, 4:48:49 PM1/4/17
to headless-dev
Hi,

Thanks for working on this. It rules.

Is there any way I can get HTTP Basic Auth proxies to work with headless mode? Right now, I have a little extension that handles configuring chrome.proxy.settings. But since headless mode doesn't support extensions, this won't work. You can't access a proxy with username/password by env vars or on the CLI. 

I'm using one proxy per process/window, so setting it at the system level doesn't make sense. 

Thanks!

Cheers,
B

burtona...@gmail.com

unread,
Jan 4, 2017, 5:05:41 PM1/4/17
to headless-dev, brad...@roboticprofit.com
I haven't tried this but you MIGHT try http://user:pa...@example.com/ as a proxy... 

It's a pseudo standard and not always supported but it has a good chance of working.

--proxy is supported on teh command line.

Bradford Stephens

unread,
Jan 4, 2017, 5:07:12 PM1/4/17
to burtona...@gmail.com, headless-dev
I've already tried that -- sadly, it does not work :(
--
----
Bradford Stephens
CEO, RoboticProfit

burtona...@gmail.com

unread,
Jan 4, 2017, 5:25:58 PM1/4/17
to headless-dev, burtona...@gmail.com, brad...@roboticprofit.com
Can you use a PAC script for this?  

I always find PAC scrips a bit of a hack but this could work.

Bradford Stephens

unread,
Jan 4, 2017, 5:35:59 PM1/4/17
to burtona...@gmail.com, headless-dev
PAC scripts don't support hardcoded user/password -- but good thinking :)

Eric Seckler

unread,
Jan 5, 2017, 5:11:29 AM1/5/17
to Bradford Stephens, burtona...@gmail.com, headless-dev
Hmm, the command line option would be --proxy-server. But I'm not sure if ProxyConfig even supports configuring passwords statically - it seems to use hostname/port pairs only. What does your extension do to configure the password?

Maybe it would help to understand why you'd like to (authenticate to and) use different proxies from headless instances. Could you alternatively run a local proxy that does the authentication to the actual proxy for you?

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.
To post to this group, send email to headle...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/headless-dev/CAAeOc3NX2RJ_i%3D49%2Bk-X8FCAuEjsAW2MUK8-C8-k-xYbNgCM3Q%40mail.gmail.com.

Bradford Stephens

unread,
Jan 5, 2017, 1:21:53 PM1/5/17
to Eric Seckler, Kevin Burton, headless-dev
I appreciate the help. I just use chrome.proxy.settings.set in my extension. 

And you're right. I could just run a local proxy. I think I'll do that instead -- I was just hoping to have one less moving component ;)

To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.

Georgios Diamantopoulos

unread,
Mar 10, 2017, 12:57:56 PM3/10/17
to headless-dev, brad...@roboticprofit.com, burtona...@gmail.com
Hi Eric,

Running a local proxy could quickly get problematic if different tabs need to use a different proxy.

Wait, first of all, is that even possible? To set the proxy per tab instead of per browser? 

Then, how is it not possible to authenticate against the proxy? I mean is it just that's not coded in headless yet or?
Could you give some pointers to its implementation?

Thank you

Sami Kyostila

unread,
Mar 14, 2017, 12:20:14 PM3/14/17
to Georgios Diamantopoulos, headless-dev, brad...@roboticprofit.com, burtona...@gmail.com
We don't support proxy authentication right now because the shell only understands a basic host:port proxy setting: crbug.com/681521. If anyone would like to contribute patches to do this we'll gladly help land them.

- Sami

Georgios Diamantopoulos

unread,
Mar 14, 2017, 12:21:38 PM3/14/17
to Sami Kyostila, headless-dev, brad...@roboticprofit.com, burtona...@gmail.com
I need that functionality so I'm definitely willing to give it a shot. Some bullet-point pointers please?

Sami Kyostila

unread,
Mar 14, 2017, 12:34:30 PM3/14/17
to Georgios Diamantopoulos, headless-dev, brad...@roboticprofit.com, burtona...@gmail.com
I'm not an expert on proxies, but based on a quick code search I think we'd need to implement a net::URLRequest::Delegate and implement the OnAuthRequired method. In normal Chrome that method pops up a dialog:


In headless mode we'd probably need to read the proxy settings from the command line.

- Sami

Georgios Diamantopoulos

unread,
Mar 14, 2017, 12:36:26 PM3/14/17
to Sami Kyostila, headless-dev, brad...@roboticprofit.com, burtona...@gmail.com
Sounds easy enough. I'll dig up the contributing guide and get started.

bas...@b26.co

unread,
Jul 6, 2017, 1:18:07 PM7/6/17
to headless-dev, brad...@roboticprofit.com
has there been any progress on this?

Alex Clarke

unread,
Jul 7, 2017, 3:21:37 AM7/7/17
to bas...@b26.co, headless-dev, brad...@roboticprofit.com
If you mean protocol support for responding to HTTP 407 auth challenges then yes support for that has landed.  If a Network.requestIntercepted event contains an authChallenge property then you can call continueInterceptedRequest with an authChallengeResponse to provide the user name and password.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.

To post to this group, send email to headle...@chromium.org.

Bashir Osman

unread,
Jul 7, 2017, 1:25:11 PM7/7/17
to headless-dev, bas...@b26.co, brad...@roboticprofit.com
Hi Alex, 

From my understand, this will only work if you use Chrome DevTools Protocol? Is there anyway I can pass the username and password as a command line? I'm running Chrome using Selenium. 

Cheers


On Friday, July 7, 2017 at 1:21:37 AM UTC-6, Alex Clarke wrote:
If you mean protocol support for responding to HTTP 407 auth challenges then yes support for that has landed.  If a Network.requestIntercepted event contains an authChallenge property then you can call continueInterceptedRequest with an authChallengeResponse to provide the user name and password.
On 6 July 2017 at 18:18, <bas...@b26.co> wrote:
has there been any progress on this?

On Wednesday, January 4, 2017 at 2:48:49 PM UTC-7, brad...@roboticprofit.com wrote:
Hi,

Thanks for working on this. It rules.

Is there any way I can get HTTP Basic Auth proxies to work with headless mode? Right now, I have a little extension that handles configuring chrome.proxy.settings. But since headless mode doesn't support extensions, this won't work. You can't access a proxy with username/password by env vars or on the CLI. 

I'm using one proxy per process/window, so setting it at the system level doesn't make sense. 

Thanks!

Cheers,
B

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev...@chromium.org.

To post to this group, send email to headle...@chromium.org.

cheera...@gmail.com

unread,
Oct 18, 2017, 4:56:22 AM10/18/17
to headless-dev, bas...@b26.co, brad...@roboticprofit.com
 I also need this feature, looking forward to any solution for it.

mik...@gmail.com

unread,
Oct 22, 2017, 1:10:44 PM10/22/17
to headless-dev, brad...@roboticprofit.com
I'd like to see this feature too, subscribing.

s...@mck-enzies.com

unread,
Nov 4, 2017, 9:02:12 AM11/4/17
to headless-dev, brad...@roboticprofit.com
Any updates?

Alex Clarke

unread,
Nov 4, 2017, 11:13:26 AM11/4/17
to s...@mck-enzies.com, headless-dev, brad...@roboticprofit.com
Is there some reason why you can't use DevTools protocol to provide the credentials?

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.

To post to this group, send email to headle...@chromium.org.

Aiden

unread,
Jan 24, 2018, 10:31:09 AM1/24/18
to headless-dev, mik...@gmail.com
Also hoping to see this feature added. 

Alex Clarke

unread,
Jan 24, 2018, 10:38:24 AM1/24/18
to Aiden, headless-dev, mik...@gmail.com
On 24 January 2018 at 15:31, 'Aiden' via headless-dev <headle...@chromium.org> wrote:
Also hoping to see this feature added. 

I doubt that will happen.  Is there some reason why you can't use DevTools protocol?
 


On Sunday, October 22, 2017 at 12:10:44 PM UTC-5, mik...@gmail.com wrote:
I'd like to see this feature too, subscribing.

--
You received this message because you are subscribed to the Google Groups "headless-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to headless-dev+unsubscribe@chromium.org.
To post to this group, send email to headle...@chromium.org.

Joel Griffith

unread,
Jan 24, 2018, 10:38:26 AM1/24/18
to headless-dev, brad...@roboticprofit.com
You should be able to do this already, as Chrome has support for proxies when you launch with the appropriate CLI switch. After that, the library has to support it via dev-tools (as mentioned above). Puppeteer can do this here: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageauthenticatecredentials

The service I run (browserless) supports this out-of-the-box: https://docs.browserless.io/configuration/parameters/


On Wednesday, January 4, 2017 at 1:48:49 PM UTC-8, brad...@roboticprofit.com wrote:

Aiden Yang

unread,
Jan 24, 2018, 11:01:23 AM1/24/18
to Joel Griffith, headless-dev, brad...@roboticprofit.com
Thanks! I wasn't aware that puppeteer supported proxy auth. I'll check it out  

--
You received this message because you are subscribed to a topic in the Google Groups "headless-dev" group.
To unsubscribe from this topic, visit https://groups.google.com/a/chromium.org/d/topic/headless-dev/KOR84u-FNU0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to headless-dev...@chromium.org.

To post to this group, send email to headle...@chromium.org.

mich...@gmail.com

unread,
Jun 24, 2018, 8:48:04 AM6/24/18
to headless-dev, brad...@roboticprofit.com
Hello, 
after few days of digging I found some solution, or more of a workaround. you still cant access proxy directly, but you can create new local transparent proxy, on which you can then connect. it is not very elegant solution, as you have to have another process running, but on the other hand it's quite clean


On Wednesday, 4 January 2017 22:48:49 UTC+1, brad...@roboticprofit.com wrote:
Reply all
Reply to author
Forward
0 new messages