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

Proxy authentication (username, password) #12

Closed
agarioBotDev opened this issue May 1, 2016 · 11 comments
Closed

Proxy authentication (username, password) #12

agarioBotDev opened this issue May 1, 2016 · 11 comments

Comments

@agarioBotDev
Copy link

Hello,

Is the proxy authentication implemented ? Cannot find it, e.g.a proxy requires username and password else status 407 will be returned...

I would be appreciated for any help,
David

@TooTallNate
Copy link
Owner

Do one of these:

In the URI

var proxy = new HttpsProxyAgent('https://username:password@your-proxy.com');

Set the auth option

var proxyOpts = url.parse('https://your-proxy.com');
proxyOpts.auth = 'username:password';
var proxy = new HttpsProxyAgent(proxyOpts);

Set the HTTP header manually

var proxyOpts = url.parse('https://your-proxy.com');
proxyOpts.headers = {
  'Proxy-Authentication': 'Basic ' + new Buffer('username:password').toString('base64')
};
var proxy = new HttpsProxyAgent(proxyOpts);

@agarioBotDev
Copy link
Author

thanks !

@okv
Copy link

okv commented Oct 30, 2017

Hi, there.
It would be nice to see that at readme page)

@axe312ger
Copy link

Yes please, add this to the readme/docs

@TooTallNate :)

@DuBistKomisch
Copy link

👍 worth mentioning, assumed the options listed would be exhaustive, so had to come digging here to confirm auth works.

@alii
Copy link

alii commented Apr 2, 2020

Bump :) Would be great on the readme

jfsiii pushed a commit to elastic/kibana that referenced this issue Jan 19, 2021
…t options (#86807)

## Summary

A user received a `407` response when using a `registryProxyUrl` format like `http://user:pass@host:port`

I believe the issue is we're not including the [`auth` property as described in this issue](TooTallNate/proxy-agents#12 (comment)). 

Add tests to ensure it only adds `auth` if username & password are given.

### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

```
  getProxyAgentOptions
    auth property
      present & correct if given username and password
        ✓ proxy url is http (1 ms)
        ✓ proxy url is https
      missing if not given username and password
        ✓ proxy url is http
        ✓ proxy url is https
```
JasonStoltz pushed a commit to JasonStoltz/kibana that referenced this issue Jan 19, 2021
…t options (elastic#86807)

## Summary

A user received a `407` response when using a `registryProxyUrl` format like `http://user:pass@host:port`

I believe the issue is we're not including the [`auth` property as described in this issue](TooTallNate/proxy-agents#12 (comment)). 

Add tests to ensure it only adds `auth` if username & password are given.

### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

```
  getProxyAgentOptions
    auth property
      present & correct if given username and password
        ✓ proxy url is http (1 ms)
        ✓ proxy url is https
      missing if not given username and password
        ✓ proxy url is http
        ✓ proxy url is https
```
jfsiii pushed a commit to jfsiii/kibana that referenced this issue Jan 23, 2021
…t options (elastic#86807)

## Summary

A user received a `407` response when using a `registryProxyUrl` format like `http://user:pass@host:port`

I believe the issue is we're not including the [`auth` property as described in this issue](TooTallNate/proxy-agents#12 (comment)). 

Add tests to ensure it only adds `auth` if username & password are given.

### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

```
  getProxyAgentOptions
    auth property
      present & correct if given username and password
        ✓ proxy url is http (1 ms)
        ✓ proxy url is https
      missing if not given username and password
        ✓ proxy url is http
        ✓ proxy url is https
```
jfsiii pushed a commit to elastic/kibana that referenced this issue Jan 24, 2021
…t options (#86807) (#89071)

## Summary

A user received a `407` response when using a `registryProxyUrl` format like `http://user:pass@host:port`

I believe the issue is we're not including the [`auth` property as described in this issue](TooTallNate/proxy-agents#12 (comment)). 

Add tests to ensure it only adds `auth` if username & password are given.

### Checklist
Delete any items that are not applicable to this PR.
- [x] [Unit or functional tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html) were updated or added to match the most common scenarios

```
  getProxyAgentOptions
    auth property
      present & correct if given username and password
        ✓ proxy url is http (1 ms)
        ✓ proxy url is https
      missing if not given username and password
        ✓ proxy url is http
        ✓ proxy url is https
```

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@jfrenl
Copy link

jfrenl commented Oct 2, 2022

How to make it that it could use a txt file.

@StreetStrider
Copy link

It would be nice to have this information in the readme. It would be easier to search for password on package's readme page and repo's readme page. The same is already true for socks-proxy-agent package.

@BlueCannonBall
Copy link

Do one of these:

In the URI

var proxy = new HttpsProxyAgent('https://username:password@your-proxy.com');

Set the auth option

var proxyOpts = url.parse('https://your-proxy.com');
proxyOpts.auth = 'username:password';
var proxy = new HttpsProxyAgent(proxyOpts);

Set the HTTP header manually

var proxyOpts = url.parse('https://your-proxy.com');
proxyOpts.headers = {
  'Proxy-Authentication': 'Basic ' + new Buffer('username:password').toString('base64')
};
var proxy = new HttpsProxyAgent(proxyOpts);

The header is called Proxy-Authorization not Proxy-Authentication.

@fbx31
Copy link

fbx31 commented Dec 6, 2023

Hi, in my company and using HttpsProxyAgent library, only the first one is working properly, aka, URI, the 2 others failed to authenticate.

@timfong888
Copy link

I am getting an openssl error, but not sure if it is due to my proxy service provider, smartproxy:

Error in audio stream for JdUVIwuNy_c: [Error: C037E8F4D43E0000:error:0A00010B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:358:

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

No branches or pull requests