From 882fc349c97c92bccc05abb6b3c657d59dd9b727 Mon Sep 17 00:00:00 2001 From: Daniel Van Der Ploeg Date: Fri, 13 Sep 2024 15:43:40 +0930 Subject: [PATCH] feat: add behaviour option to remap paths --- packages/static-hosting/lib/static-hosting.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/static-hosting/lib/static-hosting.ts b/packages/static-hosting/lib/static-hosting.ts index 7f52862b..acf36069 100644 --- a/packages/static-hosting/lib/static-hosting.ts +++ b/packages/static-hosting/lib/static-hosting.ts @@ -144,7 +144,7 @@ export interface StaticHostingProps { * * @default none */ - staticFileRemapOptions?: BehaviorOptions; + staticFileRemapOptions?: Partial; /** * Paths to remap on the default behaviour. For example you might remap deployed_sitemap.xml -> sitemap.xml @@ -295,6 +295,7 @@ export interface StaticHostingProps { interface remapPath { from: string; to?: string; + behaviour?: Partial; } export interface ResponseHeaderMappings { @@ -530,6 +531,7 @@ export class StaticHosting extends Construct { origin: backendOrigin, viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS, edgeLambdas: this.createRemapBehavior(path.from, path.to), + ...path.behaviour, }; } } @@ -553,6 +555,7 @@ export class StaticHosting extends Construct { origin: s3Origin, viewerProtocolPolicy: ViewerProtocolPolicy.REDIRECT_TO_HTTPS, edgeLambdas: this.createRemapBehavior(path.from, path.to), + ...path.behaviour, }; } }