Skip to content

Commit d2e81a9

Browse files
authored
feat(proxy): add agent options for additional customization (#24)
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
1 parent 99bc060 commit d2e81a9

File tree

6 files changed

+2254
-4913
lines changed

6 files changed

+2254
-4913
lines changed

README.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,22 @@ const client = addProxyToClient(new S3Client({}), { throwOnNoProxy: false });
6060
// `client` has no proxy assigned and no error thrown
6161
```
6262

63+
### Proxy with certs in header
64+
65+
```ts
66+
// process.env.HTTPS_PROXY = 'https://127.0.0.1'
67+
import { S3Client } from '@aws-sdk/client-s3';
68+
import { addProxyToClient } from 'aws-sdk-v3-proxy';
69+
70+
const client = addProxyToClient(new S3Client({}), {
71+
agentOptions: {
72+
proxyRequestOptions: { ca: [fs.readFileSync('custom-proxy-cert.pem').toString()] },
73+
},
74+
});
75+
76+
// `client` now has HTTPS proxy config at 'https://127.0.0.1' with ca `custom-proxy-cert.pem`
77+
```
78+
6379
## API
6480

6581
### addProxyToClient(client, options?)
@@ -95,6 +111,12 @@ Default: `false`
95111

96112
Toggles additional logging for debugging.
97113

114+
##### agentOptions
115+
116+
Type: `HttpsProxyAgentOptions`
117+
118+
Used to pass specific options to the proxy agent.
119+
98120
## Security
99121

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

104126
This project is licensed under the Apache-2.0 License.
105127

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

0 commit comments

Comments
 (0)