Skip to content

Commit

Permalink
remove age and date header and build aws sdk layer manually
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelcroi committed Jan 10, 2024
1 parent 60f97c8 commit 0fafb2b
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 25 deletions.
2 changes: 1 addition & 1 deletion cdk.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"app": "npx ts-node --prefer-ts-exts bin/cloudfront-hosting-toolkit.js",
"app": "npx ts-node --prefer-ts-exts bin/cloudfront-hosting-toolkit.ts",
"watch": {
"include": [
"**"
Expand Down
2 changes: 2 additions & 0 deletions lib/hosting_infrastructure.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ export class HostingInfrastructure extends Construct {
override: true,
},
xssProtection: { protection: true, modeBlock: true, override: true },

},
removeHeaders: ['age' , 'date'],
}
);

Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,33 +34,33 @@
"audit": "npm audit && cdk synth | cfn_nag",
"cloudfront-hosting-toolkit": "node bin/cli/index.js",
"test": "jest --coverage",
"postinstall": "npm install --prefix lambda/layers/aws_sdk/nodejs"
"postinstall": "cd lambda/layers/aws_sdk/nodejs && npm install"
},
"devDependencies": {
"@types/archiver": "5.3.2",
"@types/glob": "8.1.0",
"@types/jest": "^29.5.5",
"@types/node": "20.5.9",
"@types/prompts": "2.4.4",
"aws-cdk": "2.94.0",
"aws-cdk": "2.118.0",
"aws-sdk-client-mock": "^3.0.0",
"jest": "^29.7.0",
"ts-jest": "^29.1.1",
"ts-node": "10.9.1",
"typescript": "^5.2.2"
},
"dependencies": {
"@aws-sdk/client-acm": "^3.456.0",
"@aws-sdk/client-cloudfront": "^3.456.0",
"@aws-sdk/client-acm": "^3.484.0",
"@aws-sdk/client-cloudfront": "^3.484.0",
"@aws-sdk/client-cloudfront-keyvaluestore": "^3.484.0",
"@aws-sdk/client-codepipeline": "^3.456.0",
"@aws-sdk/client-codestar-connections": "^3.456.0",
"@aws-sdk/client-route-53": "^3.456.0",
"@aws-sdk/client-route-53-domains": "^3.456.0",
"@aws-sdk/client-s3": "^3.456.0",
"@aws-sdk/client-ssm": "^3.456.0",
"@aws-sdk/client-sts": "^3.456.0",
"@aws-sdk/types": "^3.456.0",
"@aws-sdk/client-codepipeline": "^3.484.0",
"@aws-sdk/client-codestar-connections": "^3.484.0",
"@aws-sdk/client-route-53": "^3.484.0",
"@aws-sdk/client-route-53-domains": "^3.484.0",
"@aws-sdk/client-s3": "^3.484.0",
"@aws-sdk/client-ssm": "^3.484.0",
"@aws-sdk/client-sts": "^3.484.0",
"@aws-sdk/types": "^3.484.0",
"adm-zip": "^0.5.10",
"aws-cdk": "^2.118.0",
"aws-cdk-lib": "^2.118.0",
Expand Down
4 changes: 2 additions & 2 deletions resources/build_config_templates/hosting_angularjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ phases:
- npm install -g @angular/cli
- ng build
- cd dist/static-frontend-angularjs
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line



Expand Down
4 changes: 2 additions & 2 deletions resources/build_config_templates/hosting_basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ version: 0.2
phases:
build:
commands:
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line



Expand Down
4 changes: 2 additions & 2 deletions resources/build_config_templates/hosting_nextjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ phases:
- npx next build
- npx next export
- cd out
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line

4 changes: 2 additions & 2 deletions resources/build_config_templates/hosting_reactjs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ phases:
- npx npm install
- npx npm run build
- cd build
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line



Expand Down
4 changes: 2 additions & 2 deletions resources/build_config_templates/hosting_vuejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ phases:
- npx npm install
- npx npm run build
- cd dist
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --cache-control 'max-age=60' --recursive #don't change this line
- echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line
- aws s3 cp ./ s3://$DEST_BUCKET_NAME/$CODEBUILD_RESOLVED_SOURCE_VERSION/ --recursive #don't change this line



Expand Down
4 changes: 2 additions & 2 deletions resources/build_config_templates/s3_build_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ phases:
cd temp && ls
unzip *.zip
rm *.zip
echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$COMMITID/ --cache-control 'max-age=60' --recursive #don't change this line
aws s3 cp ./ s3://$DEST_BUCKET_NAME/$COMMITID/ --cache-control 'max-age=60' --recursive #don't change this line
echo aws s3 cp ./ s3://$DEST_BUCKET_NAME/$COMMITID/ --recursive #don't change this line
aws s3 cp ./ s3://$DEST_BUCKET_NAME/$COMMITID/ --recursive #don't change this line
fi

0 comments on commit 0fafb2b

Please sign in to comment.