@@ -74,15 +74,18 @@ export function frontend(
7474 domainNames : [ props . domain . name ] ,
7575 certificate : props . domain . certificate ,
7676 } ;
77+
78+ const defaultBucketOrigin = new origins . HttpOrigin ( frontendBucket . bucketWebsiteDomainName , {
79+ protocolPolicy : OriginProtocolPolicy . HTTP_ONLY , //can not specify scope in the AWS console anymore :shrug:
80+ customHeaders : {
81+ Referer : bucketSecretReferer ,
82+ } ,
83+ } ) ;
84+
7785 const frontendDist = new cloudfront . Distribution ( scope , name ( 'web-dist' ) , {
7886 comment : name ( 'web-dist' ) ,
7987 defaultBehavior : {
80- origin : new origins . HttpOrigin ( frontendBucket . bucketWebsiteDomainName , {
81- protocolPolicy : OriginProtocolPolicy . HTTP_ONLY , //can not specify scope in the AWS console anymore :shrug:
82- customHeaders : {
83- Referer : bucketSecretReferer ,
84- } ,
85- } ) ,
88+ origin : defaultBucketOrigin ,
8689 compress : true ,
8790 viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
8891 allowedMethods : cloudfront . AllowedMethods . ALLOW_ALL ,
@@ -98,6 +101,13 @@ export function frontend(
98101 : undefined ,
99102 } ,
100103 additionalBehaviors : {
104+ '/cdn/*' : {
105+ origin : defaultBucketOrigin ,
106+ compress : true ,
107+ viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
108+ allowedMethods : cloudfront . AllowedMethods . ALLOW_ALL ,
109+ cachePolicy : cloudfront . CachePolicy . CACHING_OPTIMIZED ,
110+ } ,
101111 '/api-ingest/*' : {
102112 origin : new origins . HttpOrigin ( backendProps . apiIngestOrigin , { } ) ,
103113 allowedMethods : cloudfront . AllowedMethods . ALLOW_ALL ,
0 commit comments