Skip to main content

LambdaEdgeAdapterOptions

@h4ad/serverless-adapter > LambdaEdgeAdapterOptions

(interface) LambdaEdgeAdapterOptions

The options to customize the LambdaEdgeAdapter .

Signature:

export interface LambdaEdgeAdapterOptions 

(property) disallowedHeaders

The headers that will be stripped from the headers object because Lambda @ edge will fail if these headers are passed in the response.

Signature:

disallowedHeaders?: (string | RegExp)[];

Remarks

All headers will be compared with other headers using toLowerCase, but for the RegExp, if you modify this list, you must put the flag /gmi at the end of the RegExp (ex: /(X-Amz-Cf-)(.*)/gim )

(property) getPathFromEvent

Return the path to be used to create a request to the framework

Signature:

getPathFromEvent?: (event: CloudFrontRequestEvent['Records'][number]) => string;

Remarks

You MUST append the query params from DefaultQueryString , you can use the helper getPathWithQueryStringParams() .

(property) onResponseSizeExceedLimit

The function called when the response size exceed the max limits of the Lambda @ edge

Signature:

onResponseSizeExceedLimit?: (response: CloudFrontRequestResult) => CloudFrontRequestResult;

(property) originMaxResponseSizeInBytes

The max response size in bytes of origin request and origin response.

Reference

Signature:

originMaxResponseSizeInBytes?: number;

(property) shouldStripHeader

If you want to change how we check against the header if it should be stripped, you can pass a function to this property.

Signature:

shouldStripHeader?: (header: string) => boolean;

(property) shouldUseHeadersFromFramework

By default, the has the headers property, but we also have the headers sent by the framework too. So this setting tells us how to handle this case, if you pass true to this property, we will use the framework headers. Otherwise, we will forward the body back to cloudfront without modifying or trying to set the headers property inside .

Signature:

shouldUseHeadersFromFramework?: boolean;

(property) viewerMaxResponseSizeInBytes

The max response size in bytes of viewer request and viewer response.

Reference

Signature:

viewerMaxResponseSizeInBytes?: number;