updated regex in lambda function and updated deploy readme
parent
c81e8c9f36
commit
f20b174f0c
|
@ -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}" \
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue