AWS SDK v3 Proxy
A wrapper for adding proxy support to AWS SDK v3 clients
This wrapper adds a proxy configuration to AWS SDK clients by checking environment
variables and attaching the necessary request handler. By default, an error will
be thrown if no proxy is found in process.env
, but also has options to not throw
which can be useful when developing other node utilities using this library.
Note: http_proxy
and HTTP_PROXY
take precedence over https_proxy
and HTTPS_PROXY
.
If you would like to change this behavior it can be specified in the options.
Install
npm install aws-sdk-v3-proxy
Usage
HTTP Proxy
import { S3Client } from '@aws-sdk/client-s3';
import { addProxyToClient } from 'aws-sdk-v3-proxy';
const client = addProxyToClient(new S3Client({}));
HTTPS Proxy
import { S3Client } from '@aws-sdk/client-s3';
import { addProxyToClient } from 'aws-sdk-v3-proxy';
const client = addProxyToClient(new S3Client({}));
No Proxy with exception disabled
import { S3Client } from '@aws-sdk/client-s3';
import { addProxyToClient } from 'aws-sdk-v3-proxy';
const client = addProxyToClient(new S3Client({}), { throwOnNoProxy: false });
API
addProxyToClient(client, options?)
client
Type: Object
Any client from @aws-sdk.
options
Type: object
throwOnNoProxy
Type: boolean
Default: true
Throw an error if no proxy is found in the environment.
httpsOnly
Type: boolean
Default: false
Can be specified in cases where you have both http_proxy and https_proxy set, and would like to override the default behavior of the http_proxy taking precedence.
debug
Type: boolean
Default: false
Toggles additional logging for debugging.
Security
See CONTRIBUTING for more information.
License
This project is licensed under the Apache-2.0 License.