diff --git a/packages/static-hosting/lib/static-hosting.ts b/packages/static-hosting/lib/static-hosting.ts index 19323e01..b18e6454 100644 --- a/packages/static-hosting/lib/static-hosting.ts +++ b/packages/static-hosting/lib/static-hosting.ts @@ -617,7 +617,7 @@ export class StaticHosting extends Construct { // If the remap is to a different path, create a Lambda@Edge function to handle this // Remove special characters from path - if (from.replace(/\*$/, "") !== to && to) { + if (to && from.replace(/\*$/, "") !== to) { const id = from.replace(/[&/\\#,+()$~%'":*?<>{}]/g, "-"); const remapFunction = new PathRemapFunction(