Skip to content

Commit 335d47e

Browse files
committed
Upload the lambda function automatically during deploys
1 parent da9b0a6 commit 335d47e

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
File renamed without changes.

Diff for: deploy.sh

+14
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,17 @@ aws s3 cp build/html/_static s3://${AWS_BUCKET}/_static/ --recursive ${AWS_OPTIO
3131
# Upload static content to assets directory
3232
aws s3 cp build/html/_images s3://${AWS_BUCKET}/assets/_images/ --recursive ${AWS_OPTIONS}
3333
aws s3 cp build/html/_static s3://${AWS_BUCKET}/assets/_static/ --recursive ${AWS_OPTIONS}
34+
35+
# Create function for security headers, redirects, etc.
36+
ETAG=$(
37+
aws cloudfront create-function \
38+
--name headers-function \
39+
--function-config Comment="Headers function",Runtime="cloudfront-js-1.0" \
40+
--function-code fileb://.lambda-functions/headers.js \
41+
--query "ETag" \
42+
--output text
43+
)
44+
45+
aws cloudfront publish-function \
46+
--name headers-function \
47+
--if-match ${ETAG}

0 commit comments

Comments
 (0)