Skip to content
This repository has been archived by the owner on Mar 21, 2021. It is now read-only.

Support for authenticated proxies #37

Open
andrewlinfoot opened this issue Jul 24, 2017 · 11 comments
Open

Support for authenticated proxies #37

andrewlinfoot opened this issue Jul 24, 2017 · 11 comments

Comments

@andrewlinfoot
Copy link

Love this repo! I'm thinking about switching over one of my projects from NightmareJS to this but I need to use authenticated proxies. I know with the chrome command line flag you can pass in a proxy via --proxy-server=PROXY_URL_HERE. However, this only works for non-authenticated proxies. In NightmareJS they handle this by listening for an authentication event and then logging in.

How could I implement something similar for this repo?

If you can provide me some guidance, I'd be willing to implement the PR.

@joelgriffith
Copy link
Owner

Thanks for requesting this! I haven't dug too far into chrome's proxy functionality (especially when authentication is concerned). I've seen some discussion about it elsewhere, so I'll have to do some archaeology and get back to you. Thanks for the link as well, that will likely come in handy for us!

@joelgriffith
Copy link
Owner

joelgriffith commented Jul 26, 2017

Sweet, so I think I have this working in a branch if you're interested in testing 🙃 0.2.3-0 has just been published and supports two things: proxies and basic-auth. To use both do:

const { Chrome } = require('navalia');
const chrome = new Chrome({
  flags: {
    proxyServer: 'http://my-cool-proxy.com'
  }
});

chrome
  .auth('username', 'password') <-- fills in auth details when the proxy prompts
  .goto('http://www.google.com')
  .then((res) => console.log(res))

If this works I'll do a stable release and document it. I'm naively assuming your proxy (and most) do basic-auth, which could be mistaken (but appears to be how electron/nightmare handle it).

Let me know!

@andrewlinfoot
Copy link
Author

andrewlinfoot commented Jul 26, 2017 via email

@andrewlinfoot
Copy link
Author

Am working on testing this but I can't get it to work. My cdp.Network.requestIntercepted callback is never called. Any thoughts? Currently running on the latest version of chrome canary v62.0.3167.0 on Mac.

Btw the request interception methods weren't implemented until chrome v61. The current stable release is v60. We might need to add some documentation so people know they need to install canary for this feature.

@joelgriffith
Copy link
Owner

Could you perhaps share your script? It's possible that there's a race condition internally... I can work on getting some "best practices" docs together for Canary. It's also possible that some proxies don't do auth in the way that this protocol expects... I can dig some later on this

@joelgriffith
Copy link
Owner

Also this just launched: https://github.com/graphcool/chromeless and has gained a lot of traction already. It's likely I'll be closing this down in favor of their repo

@andrewlinfoot
Copy link
Author

I literally just got the email notification from one of my Github issues subscriptions and was reading the docs. I'll probably go with their implementation as well. Thanks for all the work you did on Navalia though! :)

@joelgriffith
Copy link
Owner

I'm not going to give up just yet. If you're still interested, let me know and we can work through it

@andrewlinfoot
Copy link
Author

@joelgriffith curious why you still want to work on Navalia vs contributing to Chromeless? I don't know much how Chromeless or Navalia work under the hood but the APIs seem almost identical and Chromeless seems to have a lot more community support. Also the Chromeless AWS Lambda integration is super awesome.

Chromeless definitely seems less feature complete and has worse docs :( Hoping that will work itself out pretty quick though.

@joelgriffith
Copy link
Owner

I have some very good news in this regard, and will be sharing more broadly once the details settle 😉

@AshCoolman
Copy link

AshCoolman commented Jan 21, 2018

Any update on this news :)?

Navalia is my favourite framework - the Dev exp totally blows me away. But still, I cannot pass up the Chromeless promise of taking ~20+ minutes of e2e tests, and distributing them across mere seconds.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants