Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Username and password auth for pac-proxy-agent. #213

Open
Ghxst opened this issue Jul 7, 2023 · 3 comments
Open

Username and password auth for pac-proxy-agent. #213

Ghxst opened this issue Jul 7, 2023 · 3 comments

Comments

@Ghxst
Copy link

Ghxst commented Jul 7, 2023

Hey, first of all thanks for this repo, it's been really useful! I was super happy to see some of the other agents supported username and password auth but haven't been able to get this to work with the pac-proxy-agent.

Simplest pac file I could write for testing:

function FindProxyForURL(url, host) {
    return 'PROXY username:password@host:port';
}

Without username:password@ it works like intended.

@TooTallNate
Copy link
Owner

TooTallNate commented Jul 10, 2023

Ya that seems reasonable. Can you also confirm if that syntax works when using this PAC file in the web browser?

Edit: Seems like the answer is no, PAC files in general do not support this syntax: https://serverfault.com/questions/394130/how-to-automatically-configure-username-password-with-proxy-pac-file

@Ghxst
Copy link
Author

Ghxst commented Jul 10, 2023

I tested this on chrome 114 with the --proxy-pac-url command line flag. Auth seemed to work fine, I'll double check to make sure.

Edit: just read your link, interesting, I suppose chrome is adding some additional logic to make it work, is it worth investigating or should I close this issue in favor of setting up a proxy server in between like suggested in the comments?

@TooTallNate
Copy link
Owner

Well, one route we could go is to add an option to the PacProxyAgent constructor, where you could specify a pair of hostname:port and the username:password to use when connecting to those proxies. Something like:

new PacProxyAgent('https://example.com/proxy.pac', {
  authentication: {
    'my-proxy.com:3128': 'username:password'
  }
});

That said, if it works in Chrome then I'd be fine supporting it in this module. I'll try to confirm myself as well.

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

No branches or pull requests

2 participants