Skip to content

Commit d7f7be8

Browse files
authored
Merge pull request #1481 from aligent/chore/DO-1852_address_pipeline_issue
DO-1852: include cspObject property to specify CSP file
2 parents 572e674 + 58a3d1b commit d7f7be8

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/static-hosting/lib/static-hosting.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,11 @@ export interface CSPConfig {
335335
* be retrieved or parsed
336336
*/
337337
fallbackCsp?: string;
338+
339+
/**
340+
* File containing CSP rules. Default: `csp.txt`
341+
*/
342+
cspObject?: string;
338343
}
339344

340345
export interface remapPath {
@@ -584,7 +589,7 @@ export class StaticHosting extends Construct {
584589

585590
const cspPaths = props.cspPaths || [];
586591
const cspRemapPaths = cspPaths.map(cspPath => {
587-
const { path, indexPath, reportUri, fallbackCsp } = cspPath;
592+
const { path, indexPath, reportUri, fallbackCsp, cspObject } = cspPath;
588593

589594
const requestFunction = new RequestFunction(
590595
this,
@@ -599,9 +604,10 @@ export class StaticHosting extends Construct {
599604
`CSPFunction-${path}`,
600605
{
601606
bucket: `${props.subDomainName}.${props.domainName}`,
602-
reportUri: reportUri,
603-
fallbackCsp: fallbackCsp,
607+
reportUri,
608+
fallbackCsp,
604609
bucketRegion: this.bucket.env.region,
610+
cspObject,
605611
}
606612
);
607613
this.bucket.grantRead(responseFunction.edgeFunction);

0 commit comments

Comments
 (0)