From 558ab482d9a28d26dd43f2b421ef24c5acb41ac1 Mon Sep 17 00:00:00 2001 From: Oliver Gutperl Date: Mon, 16 Dec 2019 08:13:20 +0100 Subject: [PATCH] Runtime updated to nodejs10.x --- README.md | 18 ++++++++++++------ index.js | 4 ++-- package.json | 2 +- sam.yaml | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 967cb7b..474265f 100644 --- a/README.md +++ b/README.md @@ -10,11 +10,11 @@ URI paths that do not have an extension and do not end with a "/" are redirected ## Examples - /foo/bar/ -> internal redirect -> /foo/bar/index.html - /foo -> external redirect (301) -> /foo/ -> internal redirect -> /foo/index.html - /foo.html -> no redirect - /foo/bar.html -> no redirect - /foo/index.html -> external redirect (301) -> /foo/ + /foo/bar/ -> internal redirect -> /foo/bar/index.html + /foo -> external redirect (301) -> /foo/ -> internal redirect -> /foo/index.html + /foo.html -> no redirect + /foo/bar.html -> no redirect + /foo/index.html -> external redirect (301) -> /foo/ ## Notes @@ -26,6 +26,12 @@ Make sure that your CloudFront distribution handles the URL "/" directly by havi ## Updating +### Lambda Runtime + +This package uses the `nodejs10.x` Node.js 10 Runtime. Updating the package in your AWS account requires one manual step, which is outlined below. + +### Procedure + 1. Install the application "standard-redirects-for-cloudfront". 2. Go to the Cloudformation Console 3. Select the Output Value, this is the ARN (including the version) for the Lambda function. @@ -69,7 +75,7 @@ Make sure that your CloudFront distribution handles the URL "/" directly by havi For any questions or comments, do contact us! -Email: contact@digital-sailors.de +Email: contact@digital-sailors.de Web: https://www.digital-sailors.de/ Enjoy! diff --git a/index.js b/index.js index 980f54c..dd951b1 100644 --- a/index.js +++ b/index.js @@ -1,7 +1,7 @@ 'use strict'; /* - Copyright 2017 DigitalSailors e.K. + Copyright 2017-2019 DigitalSailors e.K. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -18,7 +18,7 @@ exports.handler = (event, context, callback) => { const request = event.Records[0].cf.request; - + let prefixPath; // needed for 2nd condition if (request.uri.match('.+/$')) { diff --git a/package.json b/package.json index 5f8d2e2..f6a134b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "standard-redirects-for-cloudfront", - "version": "1.3.1", + "version": "1.4.0", "description": "", "main": "index.js", "scripts": { diff --git a/sam.yaml b/sam.yaml index d6fc4a1..561dc40 100644 --- a/sam.yaml +++ b/sam.yaml @@ -11,7 +11,7 @@ Resources: Type: AWS::Serverless::Function Properties: Handler: index.handler - Runtime: nodejs8.10 + Runtime: nodejs10.x Description: 'Standard Redirects for CloudFront by Digital Sailors via the Serverless Application Repository.' MemorySize: 128 Timeout: 3