I want to override generated CloudFormation functions for static-website and single-page-app constructs and add custom code, like Basic Auth, custom headers and so on.
Example Config
For that purpose I create two files: cloudfrontRequestFunctions.js and cloudfrontResponseFunctions.js and reference them under resources in our serverless.ts:
This works just fine, but the original CloudFront Functions from Lift still exist in the CloudFormation distribution and are created as well.
It results in a issue, that every distribution creates 4 CloudFront functions, and only 2 of them are used. We are extensively using temporary environments for each Merge Request and already reached the AWS CloudFront Function Limit.
Implementation Idea
The feature request is to extend current extensions block of static-website and single-page-app to include CloudFront Fucntions as well:
Possible workaround currently ma be going over resources - extensions, but for that a CloudFormation name of a generated CloudFront Function needs to be known, which is hard, since it includes hash in the name.
Example:
Start from the Use-case
I want to override generated CloudFormation functions for
static-website
andsingle-page-app
constructs and add custom code, like Basic Auth, custom headers and so on.Example Config
For that purpose I create two files: cloudfrontRequestFunctions.js and cloudfrontResponseFunctions.js and reference them under
resources
in our serverless.ts:And I use the
extensions
feature of constructs to override the functions:This works just fine, but the original CloudFront Functions from Lift still exist in the CloudFormation distribution and are created as well.
It results in a issue, that every distribution creates 4 CloudFront functions, and only 2 of them are used. We are extensively using temporary environments for each Merge Request and already reached the AWS CloudFront Function Limit.
Implementation Idea
The feature request is to extend current
extensions
block ofstatic-website
andsingle-page-app
to include CloudFront Fucntions as well:Possible workaround currently ma be going over
resources
-extensions
, but for that a CloudFormation name of a generated CloudFront Function needs to be known, which is hard, since it includes hash in the name. Example: