updated regex in lambda function and updated deploy readme

pull/14/head
Scott Anderson 2019-01-18 15:28:40 -07:00
parent c81e8c9f36
commit f20b174f0c
2 changed files with 3 additions and 3 deletions

View File

@ -6,7 +6,7 @@ Use the following command to deploy a CloudFormation stack using the template in
aws cloudformation deploy \
--template-file docs-website.yml \
--stack-name="${STACK_NAME}" \
--capabilities CAPABILITY_IAM /
--capabilities CAPABILITY_IAM \
--no-execute-changeset \
--parameter-overrides \
AcmCertificateArn="${ACM_ARN}" \

View File

@ -156,7 +156,7 @@ Resources:
removeTrailingSlash: false,
};
const regexSuffixless = /\/[^/.]+$/; // e.g. "/some/page" but not "/", "/some/" or "/some.jpg"
const regexSuffixless = /\/[a-z0-9]+([0-9\.]+)?$/; // e.g. "/some/page" but not "/", "/some/" or "/some.jpg"
const regexTrailingSlash = /.+\/$/; // e.g. "/some/" or "/some/page/" but not root "/"
exports.handler = function handler(event, context, callback) {
@ -170,7 +170,7 @@ Resources:
callback(null, request);
return;
}
// Append "index.html" to origin request
if (appendToDirs && uri.match(regexTrailingSlash)) {
request.uri = uri + appendToDirs;