A Lambda proxy that can be used to proxy requests to hit a sigV4-required target endpoint.
import { LambdaCorsProxy } from 'cdk-cors-proxy'
new LambdaCorsProxy(scope: Construct, id: string, props: LambdaCorsProxyProps)
Name | Type | Description |
---|---|---|
scope |
constructs.Construct |
No description. |
id |
string |
No description. |
props |
LambdaCorsProxyProps |
No description. |
- Type: constructs.Construct
- Type: string
- Type: LambdaCorsProxyProps
Name | Description |
---|---|
toString |
Returns a string representation of this construct. |
public toString(): string
Returns a string representation of this construct.
Name | Description |
---|---|
isConstruct |
Checks if x is a construct. |
import { LambdaCorsProxy } from 'cdk-cors-proxy'
LambdaCorsProxy.isConstruct(x: any)
Checks if x
is a construct.
- Type: any
Any object.
Name | Type | Description |
---|---|---|
node |
constructs.Node |
The tree node. |
functionUrl |
aws-cdk-lib.aws_lambda.IFunctionUrl |
No description. |
lambdaFunction |
aws-cdk-lib.aws_lambda.IFunction |
No description. |
public readonly node: Node;
- Type: constructs.Node
The tree node.
public readonly functionUrl: IFunctionUrl;
- Type: aws-cdk-lib.aws_lambda.IFunctionUrl
public readonly lambdaFunction: IFunction;
- Type: aws-cdk-lib.aws_lambda.IFunction
import { LambdaCorsProxyProps } from 'cdk-cors-proxy'
const lambdaCorsProxyProps: LambdaCorsProxyProps = { ... }
Name | Type | Description |
---|---|---|
targetEndpoint |
ProxyOptions |
No description. |
lambdaFunctionUrlOptions |
aws-cdk-lib.aws_lambda.FunctionUrlOptions |
No description. |
lambdaLogLevel |
string |
No description. |
lambdaOptions |
aws-cdk-lib.aws_lambda.FunctionOptions |
No description. |
sigV4Options |
SigV4Options |
No description. |
public readonly targetEndpoint: ProxyOptions;
- Type: ProxyOptions
public readonly lambdaFunctionUrlOptions: FunctionUrlOptions;
- Type: aws-cdk-lib.aws_lambda.FunctionUrlOptions
public readonly lambdaLogLevel: string;
- Type: string
- Default: 'info'
public readonly lambdaOptions: FunctionOptions;
- Type: aws-cdk-lib.aws_lambda.FunctionOptions
public readonly sigV4Options: SigV4Options;
- Type: SigV4Options
import { ProxyOptions } from 'cdk-cors-proxy'
const proxyOptions: ProxyOptions = { ... }
Name | Type | Description |
---|---|---|
url |
string |
No description. |
allowSelfSignedCerts |
boolean |
No description. |
forceDecodeBody |
boolean |
For 'content-type' of 'application/json' or 'text/*', body will not be base64 encoded. |
needToStripHeaderKeys |
string[] |
No description. |
public readonly url: string;
- Type: string
public readonly allowSelfSignedCerts: boolean;
- Type: boolean
- Default: false
public readonly forceDecodeBody: boolean;
- Type: boolean
- Default: false
For 'content-type' of 'application/json' or 'text/*', body will not be base64 encoded.
For other content types, please enable this option as needed.
"Don’t forget to set the request’s Content-type to application/json or text/* in your tests, otherwise, the body will be base64-encoded by default, and you’ll need to decode it in the Lambda handler." ref: https://aws.amazon.com/blogs/aws/announcing-aws-lambda-function-urls-built-in-https-endpoints-for-single-function-microservices/
public readonly needToStripHeaderKeys: string[];
- Type: string[]
- Default: LambdaCorsProxy.DEFAULT_HEADERS_TO_STRIP
import { SigV4Options } from 'cdk-cors-proxy'
const sigV4Options: SigV4Options = { ... }
Name | Type | Description |
---|---|---|
region |
string |
The targeting region. |
service |
string |
The requesting service name. |
public readonly region: string;
- Type: string
- Default: 'AWS_REGION' from Lambda runtime environment https://docs.aws.amazon.com/lambda/latest/dg/configuration-envvars.html#configuration-envvars-runtime
The targeting region.
public readonly service: string;
- Type: string
- Default: 'execute-api' for API Gateway
The requesting service name.
import { Hello } from 'cdk-cors-proxy'
new Hello()
Name | Type | Description |
---|
Name | Description |
---|---|
sayHello |
No description. |
public sayHello(): string