From e4601e3772a47ac7532c51aaa4c9e7874492a49f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ole=20Volds=C3=A6ter?= <ole.voldsater@uib.no>
Date: Fri, 11 Sep 2020 10:17:17 +0200
Subject: [PATCH] redirect til api/index.html

---
 .gitlab-ci.yml                    | 5 ++++-
 aws/beta.ordbok.uib.no_stack.yaml | 6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index fdddc43d..ee9ee0ae 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,7 +28,10 @@ deploy:
                               --capabilities CAPABILITY_IAM
   - aws s3 rm "s3://${STACK_NAME}.aws.uib.no" --recursive
   - aws s3 sync dist/ "s3://${STACK_NAME}.aws.uib.no" --delete
-  - aws s3api put-object --bucket "${STACK_NAME}.aws.uib.no" --key api/index.html --body api_static/index.html
+  - aws s3api put-object --bucket "${STACK_NAME}.aws.uib.no"
+                         --key api/index.html
+                         --body api_static/index.html
+                         --content-type "text/html;charset=UTF-8"
   - DISTRO_ID=$(aws cloudformation describe-stack-resource
                                    --stack-name ${STACK_NAME}
                                    --logical-resource-id Distribution
diff --git a/aws/beta.ordbok.uib.no_stack.yaml b/aws/beta.ordbok.uib.no_stack.yaml
index ff12a1be..23e000a5 100644
--- a/aws/beta.ordbok.uib.no_stack.yaml
+++ b/aws/beta.ordbok.uib.no_stack.yaml
@@ -143,6 +143,10 @@ Resources:
           - HEAD
           Compress: true
           TargetOriginId: s3ProductionBucket
+          LambdaFunctionAssociations:
+            - EventType: viewer-request
+              IncludeBody: false
+              LambdaFunctionARN: "arn:aws:lambda:us-east-1:156160966877:function:path_rewrite:7"
           ForwardedValues:
             QueryString: 'false'
             Cookies:
@@ -165,7 +169,7 @@ Resources:
             LambdaFunctionAssociations:
               - EventType: viewer-request
                 IncludeBody: false
-                LambdaFunctionARN: "arn:aws:lambda:us-east-1:156160966877:function:path_rewrite:2"
+                LambdaFunctionARN: "arn:aws:lambda:us-east-1:156160966877:function:path_rewrite:7"
             ForwardedValues:
               QueryString: true
               Cookies:
-- 
GitLab