Skip to content

Commit

Permalink
feat(proxy): add agent options for additional customization
Browse files Browse the repository at this point in the history
This change adds options for the proxy agent that can be passed in by the user. A couple uses for
this include assigning certs and modifying headers used by the agent.

close #23
  • Loading branch information
ryansonshine committed Jun 2, 2023
1 parent 99bc060 commit be15e0b
Show file tree
Hide file tree
Showing 6 changed files with 2,254 additions and 4,913 deletions.
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ const client = addProxyToClient(new S3Client({}), { throwOnNoProxy: false });
// `client` has no proxy assigned and no error thrown
```

### Proxy with certs in header

```ts
// process.env.HTTPS_PROXY = 'https://127.0.0.1'
import { S3Client } from '@aws-sdk/client-s3';
import { addProxyToClient } from 'aws-sdk-v3-proxy';

const client = addProxyToClient(new S3Client({}), {
agentOptions: {
proxyRequestOptions: { ca: [fs.readFileSync('custom-proxy-cert.pem').toString()] },
},
});

// `client` now has HTTPS proxy config at 'https://127.0.0.1' with ca `custom-proxy-cert.pem`
```

## API

### addProxyToClient(client, options?)
Expand Down Expand Up @@ -95,6 +111,12 @@ Default: `false`

Toggles additional logging for debugging.

##### agentOptions

Type: `HttpsProxyAgentOptions`

Used to pass specific options to the proxy agent.

## Security

See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more information.
Expand All @@ -103,7 +125,6 @@ See [CONTRIBUTING](CONTRIBUTING.md#security-issue-notifications) for more inform

This project is licensed under the Apache-2.0 License.


[build-img]:https://github.com/awslabs/aws-sdk-v3-js-proxy/actions/workflows/release.yml/badge.svg
[build-url]:https://github.com/awslabs/aws-sdk-v3-js-proxy/actions/workflows/release.yml
[downloads-img]:https://img.shields.io/npm/dt/aws-sdk-v3-proxy
Expand Down
Loading

0 comments on commit be15e0b

Please sign in to comment.