@@ -32,6 +32,7 @@ export class CdnStack {
32
32
cdnCachePolicy : cloudfront . CachePolicy
33
33
apiCachePolicy : cloudfront . CachePolicy | undefined
34
34
vanityUrl : string
35
+ realtimeLogConfig : cloudfront . RealtimeLogConfig
35
36
props : CdnStackProps
36
37
37
38
constructor ( scope : Construct , props : CdnStackProps ) {
@@ -72,7 +73,7 @@ export class CdnStack {
72
73
// })
73
74
74
75
// TODO: make this configurable
75
- const realtimeLogConfig = new cloudfront . RealtimeLogConfig ( scope , 'StacksRealTimeLogConfig' , {
76
+ this . realtimeLogConfig = new cloudfront . RealtimeLogConfig ( scope , 'StacksRealTimeLogConfig' , {
76
77
endPoints : [
77
78
cloudfront . Endpoint . fromKinesisStream ( logStream ) ,
78
79
] ,
@@ -119,7 +120,7 @@ export class CdnStack {
119
120
cachedMethods : this . cachedMethods ( ) ,
120
121
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
121
122
cachePolicy : this . cdnCachePolicy ,
122
- realtimeLogConfig,
123
+ realtimeLogConfig : this . realtimeLogConfig ,
123
124
} ,
124
125
125
126
additionalBehaviors : this . additionalBehaviors ( scope , props ) ,
@@ -249,6 +250,7 @@ export class CdnStack {
249
250
cachedMethods : cloudfront . CachedMethods . CACHE_GET_HEAD_OPTIONS ,
250
251
cachePolicy : this . setApiCachePolicy ( scope ) ,
251
252
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
253
+ realtimeLogConfig : this . realtimeLogConfig ,
252
254
} ,
253
255
'/api/*' : {
254
256
origin : origin ( '/api/*' ) ,
@@ -257,6 +259,7 @@ export class CdnStack {
257
259
cachedMethods : cloudfront . CachedMethods . CACHE_GET_HEAD_OPTIONS ,
258
260
cachePolicy : this . apiCachePolicy ,
259
261
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
262
+ realtimeLogConfig : this . realtimeLogConfig ,
260
263
} ,
261
264
}
262
265
}
@@ -273,6 +276,7 @@ export class CdnStack {
273
276
cachedMethods : this . cachedMethodsFromString ( config . cloud . cdn ?. cachedMethods ) ,
274
277
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
275
278
cachePolicy : cloudfront . CachePolicy . CACHING_OPTIMIZED ,
279
+ realtimeLogConfig : this . realtimeLogConfig ,
276
280
} ,
277
281
'/docs/*' : {
278
282
origin : new origins . S3Origin ( props . publicBucket , {
@@ -284,6 +288,7 @@ export class CdnStack {
284
288
cachedMethods : this . cachedMethodsFromString ( config . cloud . cdn ?. cachedMethods ) ,
285
289
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
286
290
cachePolicy : cloudfront . CachePolicy . CACHING_OPTIMIZED ,
291
+ realtimeLogConfig : this . realtimeLogConfig ,
287
292
} ,
288
293
}
289
294
}
@@ -312,6 +317,7 @@ export class CdnStack {
312
317
allowedMethods : cloudfront . AllowedMethods . ALLOW_ALL ,
313
318
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
314
319
cachePolicy : aiCachePolicy ,
320
+ realtimeLogConfig : this . realtimeLogConfig ,
315
321
} ,
316
322
'/ai/summary' : {
317
323
origin : new origins . HttpOrigin ( summaryHostname , {
@@ -322,6 +328,7 @@ export class CdnStack {
322
328
allowedMethods : cloudfront . AllowedMethods . ALLOW_ALL ,
323
329
viewerProtocolPolicy : cloudfront . ViewerProtocolPolicy . REDIRECT_TO_HTTPS ,
324
330
cachePolicy : aiCachePolicy ,
331
+ realtimeLogConfig : this . realtimeLogConfig ,
325
332
} ,
326
333
}
327
334
}
@@ -347,6 +354,7 @@ export class CdnStack {
347
354
headerBehavior : cloudfront . CacheHeaderBehavior . none ( ) ,
348
355
queryStringBehavior : cloudfront . CacheQueryStringBehavior . none ( ) ,
349
356
} ) ,
357
+ realtimeLogConfig : this . realtimeLogConfig , // we potentially want to allow for tracking 100% of the traffic here?
350
358
} ,
351
359
}
352
360
}
0 commit comments