aws-solutions-constructs icon indicating copy to clipboard operation
aws-solutions-constructs copied to clipboard

CloudFront Lambda function created when insertHttpSecurityHeaders is false

Open jlosito opened this issue 2 years ago • 3 comments

I have a website being served with the CloudFrontToS3 construct, and I noticed that even if I set the insertHttpSecurityHeaders to false, the SetHttpSecurityHeaders lambda is still created. I would like if the lambda was not created if I'm not using it.


This is :bug: Bug Report

jlosito avatar Jan 26 '24 22:01 jlosito

Thanks, we'll take a look

biffgaut avatar Jan 30 '24 16:01 biffgaut

Can you share a code sample and version information where you are seeing this behavior. When we run he code below there is no Lambda function created using v2.51.0 of the construct.

import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
import { CloudFrontToS3, CloudFrontToS3Props} from '@aws-solutions-constructs/aws-cloudfront-s3';

export class Issue1061Stack extends cdk.Stack {
  constructor(scope: Construct, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    const issueProps: CloudFrontToS3Props = {
      insertHttpSecurityHeaders: false
    }

    new CloudFrontToS3(this, 'issue1061test', issueProps);
  }
}

biffgaut avatar Feb 09 '24 16:02 biffgaut

@biffgaut I recognize I owe you some code. I plan on deploying something this week and upload some screenshots.

jlosito avatar Feb 14 '24 15:02 jlosito