quidproquo-deploy-awscdk 0.0.152 → 0.0.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+ import { CacheQPQWebServerConfigSetting } from 'quidproquo-webserver';
3
+ import { QpqConstructBlock, QpqConstructBlockProps } from '../../../base/QpqConstructBlock';
4
+ import { Construct } from 'constructs';
5
+ import { aws_cloudfront } from 'aws-cdk-lib';
6
+ export interface QpqWebServerCacheConstructProps extends QpqConstructBlockProps {
7
+ cacheConfig: CacheQPQWebServerConfigSetting;
8
+ }
9
+ export declare class QpqWebServerCacheConstruct extends QpqConstructBlock {
10
+ cachePolicy: aws_cloudfront.ICachePolicy;
11
+ static fromOtherStack(scope: Construct, id: string, qpqConfig: QPQConfig, cacheConfig: CacheQPQWebServerConfigSetting, awsAccountId: string): QpqWebServerCacheConstruct;
12
+ constructor(scope: Construct, id: string, props: QpqWebServerCacheConstructProps);
13
+ }
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.QpqWebServerCacheConstruct = void 0;
27
+ const quidproquo_webserver_1 = require("quidproquo-webserver");
28
+ const QpqConstructBlock_1 = require("../../../base/QpqConstructBlock");
29
+ const aws_cdk_lib_1 = require("aws-cdk-lib");
30
+ const cdk = __importStar(require("aws-cdk-lib"));
31
+ const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
32
+ const qpqDeployAwsCdkUtils = __importStar(require("../../../../utils"));
33
+ class QpqWebServerCacheConstruct extends QpqConstructBlock_1.QpqConstructBlock {
34
+ static fromOtherStack(scope, id, qpqConfig, cacheConfig, awsAccountId) {
35
+ var _a, _b;
36
+ const cachePolicyId = qpqDeployAwsCdkUtils.importStackValue(quidproquo_actionprocessor_awslambda_1.awsNamingUtils.getCFExportNameCachePolicyIdFromConfig(cacheConfig.name, qpqConfig, (_a = cacheConfig.owner) === null || _a === void 0 ? void 0 : _a.module, (_b = cacheConfig.owner) === null || _b === void 0 ? void 0 : _b.application));
37
+ console.log('cachePolicyId', cachePolicyId);
38
+ class Import extends QpqConstructBlock_1.QpqConstructBlock {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.cachePolicy = aws_cdk_lib_1.aws_cloudfront.CachePolicy.fromCachePolicyId(scope, `${id}-${cacheConfig.uniqueKey}`, cachePolicyId);
42
+ }
43
+ }
44
+ return new Import(scope, id, { qpqConfig, awsAccountId });
45
+ }
46
+ constructor(scope, id, props) {
47
+ var _a, _b;
48
+ super(scope, id, props);
49
+ this.cachePolicy = new aws_cdk_lib_1.aws_cloudfront.CachePolicy(this, `dist-cp`, {
50
+ cachePolicyName: this.resourceName(props.cacheConfig.name),
51
+ defaultTtl: cdk.Duration.seconds(props.cacheConfig.cache.defaultTTLInSeconds),
52
+ minTtl: cdk.Duration.seconds(props.cacheConfig.cache.minTTLInSeconds),
53
+ maxTtl: cdk.Duration.seconds(props.cacheConfig.cache.maxTTLInSeconds),
54
+ headerBehavior: aws_cdk_lib_1.aws_cloudfront.CacheHeaderBehavior.allowList(quidproquo_webserver_1.qpqHeaderIsBot),
55
+ enableAcceptEncodingGzip: true,
56
+ enableAcceptEncodingBrotli: true,
57
+ });
58
+ qpqDeployAwsCdkUtils.exportStackValue(this, quidproquo_actionprocessor_awslambda_1.awsNamingUtils.getCFExportNameCachePolicyIdFromConfig(props.cacheConfig.name, props.qpqConfig, (_a = props.cacheConfig.owner) === null || _a === void 0 ? void 0 : _a.module, (_b = props.cacheConfig.owner) === null || _b === void 0 ? void 0 : _b.application), this.cachePolicy.cachePolicyId);
59
+ }
60
+ }
61
+ exports.QpqWebServerCacheConstruct = QpqWebServerCacheConstruct;
@@ -37,6 +37,7 @@ const securityHeaders_1 = require("./utils/securityHeaders");
37
37
  const quidproquo_actionprocessor_awslambda_1 = require("quidproquo-actionprocessor-awslambda");
38
38
  const QpqConstructBlock_1 = require("../../../base/QpqConstructBlock");
39
39
  const qpqDeployAwsCdkUtils = __importStar(require("../../../../utils"));
40
+ const QpqWebServerCacheConstruct_1 = require("../cache/QpqWebServerCacheConstruct");
40
41
  class QpqWebserverWebEntryConstruct extends QpqConstructBlock_1.QpqConstructBlock {
41
42
  constructor(scope, id, props) {
42
43
  super(scope, id, props);
@@ -104,33 +105,31 @@ class QpqWebserverWebEntryConstruct extends QpqConstructBlock_1.QpqConstructBloc
104
105
  description: `access to s3 bucket ${originBucket.bucketName}`,
105
106
  },
106
107
  });
107
- const cachePolicy = new aws_cdk_lib_1.aws_cloudfront.CachePolicy(this, `dist-cp`, {
108
- cachePolicyName: this.resourceName(props.webEntryConfig.name),
109
- defaultTtl: cdk.Duration.seconds(props.webEntryConfig.cache.defaultTTLInSeconds),
110
- minTtl: cdk.Duration.seconds(props.webEntryConfig.cache.minTTLInSeconds),
111
- maxTtl: cdk.Duration.seconds(props.webEntryConfig.cache.maxTTLInSeconds),
112
- headerBehavior: aws_cdk_lib_1.aws_cloudfront.CacheHeaderBehavior.allowList(quidproquo_webserver_1.qpqHeaderIsBot),
113
- enableAcceptEncodingGzip: true,
114
- enableAcceptEncodingBrotli: true,
115
- });
116
- const responseHeaderPolicy = new aws_cdk_lib_1.aws_cloudfront.ResponseHeadersPolicy(this, `dist-rhp`, {
117
- responseHeadersPolicyName: this.resourceName(props.webEntryConfig.name),
118
- customHeadersBehavior: {
119
- customHeaders: [
120
- {
121
- header: 'Cache-Control',
122
- value: `max-age=${props.webEntryConfig.cache.maxTTLInSeconds}${props.webEntryConfig.cache.mustRevalidate ? ', must-revalidate' : ''}`,
123
- override: true,
124
- },
125
- ],
126
- },
127
- securityHeadersBehavior: (0, securityHeaders_1.convertSecurityHeadersFromQpqSecurityHeaders)(quidproquo_webserver_1.qpqWebServerUtils.getBaseDomainName(props.qpqConfig), props.webEntryConfig.securityHeaders),
128
- });
108
+ const cachePolicy = props.webEntryConfig.cacheSettingsName
109
+ ? QpqWebServerCacheConstruct_1.QpqWebServerCacheConstruct.fromOtherStack(this, 'cache', props.qpqConfig, quidproquo_webserver_1.qpqWebServerUtils.getCacheConfigByName(props.webEntryConfig.cacheSettingsName, props.qpqConfig), props.awsAccountId).cachePolicy
110
+ : aws_cdk_lib_1.aws_cloudfront.CachePolicy.CACHING_DISABLED;
111
+ const responseHeaderPolicy = props.webEntryConfig.securityHeaders &&
112
+ new aws_cdk_lib_1.aws_cloudfront.ResponseHeadersPolicy(this, `dist-rhp`, {
113
+ responseHeadersPolicyName: this.resourceName(props.webEntryConfig.name),
114
+ // customHeadersBehavior: {
115
+ // customHeaders: [
116
+ // {
117
+ // header: 'Cache-Control',
118
+ // value: `max-age=${props.webEntryConfig.cache.maxTTLInSeconds}${
119
+ // props.webEntryConfig.cache.mustRevalidate ? ', must-revalidate' : ''
120
+ // }`,
121
+ // override: true,
122
+ // },
123
+ // ],
124
+ // },
125
+ securityHeadersBehavior: (0, securityHeaders_1.convertSecurityHeadersFromQpqSecurityHeaders)(quidproquo_webserver_1.qpqWebServerUtils.getBaseDomainName(props.qpqConfig), props.webEntryConfig.securityHeaders),
126
+ });
129
127
  // Create a CloudFront distribution using the S3 bucket as the origin
130
128
  const distributionOrigin = new aws_cdk_lib_1.aws_cloudfront_origins.S3Origin(originBucket);
131
129
  const distribution = new aws_cdk_lib_1.aws_cloudfront.Distribution(this, 'MyDistribution', {
132
130
  defaultBehavior: {
133
131
  origin: distributionOrigin,
132
+ originRequestPolicy: aws_cdk_lib_1.aws_cloudfront.OriginRequestPolicy.CORS_S3_ORIGIN,
134
133
  cachePolicy: cachePolicy,
135
134
  viewerProtocolPolicy: aws_cdk_lib_1.aws_cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
136
135
  compress: props.webEntryConfig.compressFiles,
@@ -218,25 +217,14 @@ class QpqWebserverWebEntryConstruct extends QpqConstructBlock_1.QpqConstructBloc
218
217
  }
219
218
  // TODO: Find a better solution for this.
220
219
  // Removed this because aws limits for the number of AWS CloudFront Cache Policies in your account
221
- // const seoCachePolicy = new aws_cloudfront.CachePolicy(this, `seo-cp-${seo.uniqueKey}`, {
222
- // cachePolicyName: this.resourceName(`${props.webEntryConfig.name}-${seo.uniqueKey}`),
223
- // headerBehavior: aws_cloudfront.CacheHeaderBehavior.allowList(
224
- // qpqHeaderIsBot,
225
- // ...seo.cache.headers,
226
- // ),
227
- // defaultTtl: cdk.Duration.seconds(seo.cache.defaultTTLInSeconds),
228
- // minTtl: cdk.Duration.seconds(seo.cache.minTTLInSeconds),
229
- // maxTtl: cdk.Duration.seconds(seo.cache.maxTTLInSeconds),
230
- // enableAcceptEncodingGzip: true,
231
- // enableAcceptEncodingBrotli: true,
232
- // });
220
+ const seoCachePolicy = seo.cacheSettingsName
221
+ ? QpqWebServerCacheConstruct_1.QpqWebServerCacheConstruct.fromOtherStack(this, `seo-cache-${seo.uniqueKey}`, props.qpqConfig, quidproquo_webserver_1.qpqWebServerUtils.getCacheConfigByName(seo.cacheSettingsName, props.qpqConfig), props.awsAccountId).cachePolicy
222
+ : aws_cdk_lib_1.aws_cloudfront.CachePolicy.CACHING_DISABLED;
233
223
  const wildcardPath = seo.path.replaceAll(/{(.+?)}/g, '*');
234
224
  distribution.addBehavior(wildcardPath, distributionOrigin, {
235
- cachePolicy: cachePolicy,
236
- // cachePolicy: seoCachePolicy,
225
+ cachePolicy: seoCachePolicy,
237
226
  viewerProtocolPolicy: aws_cdk_lib_1.aws_cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
238
227
  compress: props.webEntryConfig.compressFiles,
239
- responseHeadersPolicy: responseHeaderPolicy,
240
228
  edgeLambdas: [
241
229
  {
242
230
  functionVersion: edgeFunctionVR.currentVersion,
@@ -5,6 +5,7 @@ const quidproquo_core_1 = require("quidproquo-core");
5
5
  const quidproquo_webserver_1 = require("quidproquo-webserver");
6
6
  const QpqServiceStack_1 = require("./base/QpqServiceStack");
7
7
  const constructs_1 = require("../constructs");
8
+ const QpqWebServerCacheConstruct_1 = require("../constructs/feature/webserver/cache/QpqWebServerCacheConstruct");
8
9
  class InfQpqServiceStack extends QpqServiceStack_1.QpqServiceStack {
9
10
  constructor(scope, id, props) {
10
11
  super(scope, id, props);
@@ -73,6 +74,12 @@ class InfQpqServiceStack extends QpqServiceStack_1.QpqServiceStack {
73
74
  qpqConfig: props.qpqConfig,
74
75
  websocketConfig: setting,
75
76
  }));
77
+ // Cache settings
78
+ const cache = quidproquo_webserver_1.qpqWebServerUtils.getAllOwnedCacheConfigs(props.qpqConfig).map((setting) => new QpqWebServerCacheConstruct_1.QpqWebServerCacheConstruct(this, quidproquo_core_1.qpqCoreUtils.getUniqueKeyForSetting(setting), {
79
+ awsAccountId: props.awsAccountId,
80
+ qpqConfig: props.qpqConfig,
81
+ cacheConfig: setting,
82
+ }));
76
83
  }
77
84
  }
78
85
  exports.InfQpqServiceStack = InfQpqServiceStack;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "quidproquo-deploy-awscdk",
3
- "version": "0.0.152",
3
+ "version": "0.0.154",
4
4
  "description": "",
5
5
  "main": "./lib/commonjs/index.js",
6
6
  "types": "./lib/commonjs/index.d.js",
@@ -0,0 +1,76 @@
1
+ import { QPQConfig } from 'quidproquo-core';
2
+
3
+ import { CacheQPQWebServerConfigSetting, qpqHeaderIsBot } from 'quidproquo-webserver';
4
+
5
+ import { QpqConstructBlock, QpqConstructBlockProps } from '../../../base/QpqConstructBlock';
6
+
7
+ import { Construct } from 'constructs';
8
+ import { aws_s3, aws_cloudfront } from 'aws-cdk-lib';
9
+ import * as cdk from 'aws-cdk-lib';
10
+
11
+ import { awsNamingUtils } from 'quidproquo-actionprocessor-awslambda';
12
+ import * as qpqDeployAwsCdkUtils from '../../../../utils';
13
+
14
+ export interface QpqWebServerCacheConstructProps extends QpqConstructBlockProps {
15
+ cacheConfig: CacheQPQWebServerConfigSetting;
16
+ }
17
+
18
+ export class QpqWebServerCacheConstruct extends QpqConstructBlock {
19
+ cachePolicy: aws_cloudfront.ICachePolicy;
20
+
21
+ static fromOtherStack(
22
+ scope: Construct,
23
+ id: string,
24
+ qpqConfig: QPQConfig,
25
+ cacheConfig: CacheQPQWebServerConfigSetting,
26
+ awsAccountId: string,
27
+ ): QpqWebServerCacheConstruct {
28
+ const cachePolicyId = qpqDeployAwsCdkUtils.importStackValue(
29
+ awsNamingUtils.getCFExportNameCachePolicyIdFromConfig(
30
+ cacheConfig.name,
31
+ qpqConfig,
32
+ cacheConfig.owner?.module,
33
+ cacheConfig.owner?.application,
34
+ ),
35
+ );
36
+
37
+ console.log('cachePolicyId', cachePolicyId);
38
+
39
+ class Import extends QpqConstructBlock {
40
+ cachePolicy = aws_cloudfront.CachePolicy.fromCachePolicyId(
41
+ scope,
42
+ `${id}-${cacheConfig.uniqueKey}`,
43
+ cachePolicyId,
44
+ );
45
+ }
46
+
47
+ return new Import(scope, id, { qpqConfig, awsAccountId });
48
+ }
49
+
50
+ constructor(scope: Construct, id: string, props: QpqWebServerCacheConstructProps) {
51
+ super(scope, id, props);
52
+
53
+ this.cachePolicy = new aws_cloudfront.CachePolicy(this, `dist-cp`, {
54
+ cachePolicyName: this.resourceName(props.cacheConfig.name),
55
+ defaultTtl: cdk.Duration.seconds(props.cacheConfig.cache.defaultTTLInSeconds),
56
+ minTtl: cdk.Duration.seconds(props.cacheConfig.cache.minTTLInSeconds),
57
+ maxTtl: cdk.Duration.seconds(props.cacheConfig.cache.maxTTLInSeconds),
58
+
59
+ headerBehavior: aws_cloudfront.CacheHeaderBehavior.allowList(qpqHeaderIsBot),
60
+
61
+ enableAcceptEncodingGzip: true,
62
+ enableAcceptEncodingBrotli: true,
63
+ });
64
+
65
+ qpqDeployAwsCdkUtils.exportStackValue(
66
+ this,
67
+ awsNamingUtils.getCFExportNameCachePolicyIdFromConfig(
68
+ props.cacheConfig.name,
69
+ props.qpqConfig,
70
+ props.cacheConfig.owner?.module,
71
+ props.cacheConfig.owner?.application,
72
+ ),
73
+ this.cachePolicy.cachePolicyId,
74
+ );
75
+ }
76
+ }
@@ -29,6 +29,7 @@ import { QpqConstructBlock, QpqConstructBlockProps } from '../../../base/QpqCons
29
29
  import { Construct } from 'constructs';
30
30
 
31
31
  import * as qpqDeployAwsCdkUtils from '../../../../utils';
32
+ import { QpqWebServerCacheConstruct } from '../cache/QpqWebServerCacheConstruct';
32
33
 
33
34
  export interface QpqWebserverWebEntryConstructProps extends QpqConstructBlockProps {
34
35
  webEntryConfig: WebEntryQPQWebServerConfigSetting;
@@ -126,42 +127,47 @@ export class QpqWebserverWebEntryConstruct extends QpqConstructBlock {
126
127
  },
127
128
  );
128
129
 
129
- const cachePolicy = new aws_cloudfront.CachePolicy(this, `dist-cp`, {
130
- cachePolicyName: this.resourceName(props.webEntryConfig.name),
131
- defaultTtl: cdk.Duration.seconds(props.webEntryConfig.cache.defaultTTLInSeconds),
132
- minTtl: cdk.Duration.seconds(props.webEntryConfig.cache.minTTLInSeconds),
133
- maxTtl: cdk.Duration.seconds(props.webEntryConfig.cache.maxTTLInSeconds),
134
-
135
- headerBehavior: aws_cloudfront.CacheHeaderBehavior.allowList(qpqHeaderIsBot),
136
-
137
- enableAcceptEncodingGzip: true,
138
- enableAcceptEncodingBrotli: true,
139
- });
140
-
141
- const responseHeaderPolicy = new aws_cloudfront.ResponseHeadersPolicy(this, `dist-rhp`, {
142
- responseHeadersPolicyName: this.resourceName(props.webEntryConfig.name),
143
- customHeadersBehavior: {
144
- customHeaders: [
145
- {
146
- header: 'Cache-Control',
147
- value: `max-age=${props.webEntryConfig.cache.maxTTLInSeconds}${
148
- props.webEntryConfig.cache.mustRevalidate ? ', must-revalidate' : ''
149
- }`,
150
- override: true,
151
- },
152
- ],
153
- },
154
- securityHeadersBehavior: convertSecurityHeadersFromQpqSecurityHeaders(
155
- qpqWebServerUtils.getBaseDomainName(props.qpqConfig),
156
- props.webEntryConfig.securityHeaders,
157
- ),
158
- });
130
+ const cachePolicy = props.webEntryConfig.cacheSettingsName
131
+ ? QpqWebServerCacheConstruct.fromOtherStack(
132
+ this,
133
+ 'cache',
134
+ props.qpqConfig,
135
+ qpqWebServerUtils.getCacheConfigByName(
136
+ props.webEntryConfig.cacheSettingsName,
137
+ props.qpqConfig,
138
+ ),
139
+ props.awsAccountId,
140
+ ).cachePolicy
141
+ : aws_cloudfront.CachePolicy.CACHING_DISABLED;
142
+
143
+ const responseHeaderPolicy =
144
+ props.webEntryConfig.securityHeaders &&
145
+ new aws_cloudfront.ResponseHeadersPolicy(this, `dist-rhp`, {
146
+ responseHeadersPolicyName: this.resourceName(props.webEntryConfig.name),
147
+ // customHeadersBehavior: {
148
+ // customHeaders: [
149
+ // {
150
+ // header: 'Cache-Control',
151
+ // value: `max-age=${props.webEntryConfig.cache.maxTTLInSeconds}${
152
+ // props.webEntryConfig.cache.mustRevalidate ? ', must-revalidate' : ''
153
+ // }`,
154
+ // override: true,
155
+ // },
156
+ // ],
157
+ // },
158
+ securityHeadersBehavior: convertSecurityHeadersFromQpqSecurityHeaders(
159
+ qpqWebServerUtils.getBaseDomainName(props.qpqConfig),
160
+ props.webEntryConfig.securityHeaders,
161
+ ),
162
+ });
159
163
 
160
164
  // Create a CloudFront distribution using the S3 bucket as the origin
161
165
  const distributionOrigin = new aws_cloudfront_origins.S3Origin(originBucket);
162
166
  const distribution = new aws_cloudfront.Distribution(this, 'MyDistribution', {
163
167
  defaultBehavior: {
164
168
  origin: distributionOrigin,
169
+ originRequestPolicy: aws_cloudfront.OriginRequestPolicy.CORS_S3_ORIGIN,
170
+
165
171
  cachePolicy: cachePolicy,
166
172
  viewerProtocolPolicy: aws_cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
167
173
  compress: props.webEntryConfig.compressFiles,
@@ -295,26 +301,21 @@ export class QpqWebserverWebEntryConstruct extends QpqConstructBlock {
295
301
 
296
302
  // TODO: Find a better solution for this.
297
303
  // Removed this because aws limits for the number of AWS CloudFront Cache Policies in your account
298
- // const seoCachePolicy = new aws_cloudfront.CachePolicy(this, `seo-cp-${seo.uniqueKey}`, {
299
- // cachePolicyName: this.resourceName(`${props.webEntryConfig.name}-${seo.uniqueKey}`),
300
- // headerBehavior: aws_cloudfront.CacheHeaderBehavior.allowList(
301
- // qpqHeaderIsBot,
302
- // ...seo.cache.headers,
303
- // ),
304
- // defaultTtl: cdk.Duration.seconds(seo.cache.defaultTTLInSeconds),
305
- // minTtl: cdk.Duration.seconds(seo.cache.minTTLInSeconds),
306
- // maxTtl: cdk.Duration.seconds(seo.cache.maxTTLInSeconds),
307
- // enableAcceptEncodingGzip: true,
308
- // enableAcceptEncodingBrotli: true,
309
- // });
304
+ const seoCachePolicy = seo.cacheSettingsName
305
+ ? QpqWebServerCacheConstruct.fromOtherStack(
306
+ this,
307
+ `seo-cache-${seo.uniqueKey}`,
308
+ props.qpqConfig,
309
+ qpqWebServerUtils.getCacheConfigByName(seo.cacheSettingsName, props.qpqConfig),
310
+ props.awsAccountId,
311
+ ).cachePolicy
312
+ : aws_cloudfront.CachePolicy.CACHING_DISABLED;
310
313
 
311
314
  const wildcardPath = seo.path.replaceAll(/{(.+?)}/g, '*');
312
315
  distribution.addBehavior(wildcardPath, distributionOrigin, {
313
- cachePolicy: cachePolicy,
314
- // cachePolicy: seoCachePolicy,
316
+ cachePolicy: seoCachePolicy,
315
317
  viewerProtocolPolicy: aws_cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
316
318
  compress: props.webEntryConfig.compressFiles,
317
- responseHeadersPolicy: responseHeaderPolicy,
318
319
  edgeLambdas: [
319
320
  {
320
321
  functionVersion: edgeFunctionVR.currentVersion,
@@ -17,6 +17,7 @@ import {
17
17
  QpqWebserverWebsocketConstruct,
18
18
  LogStorage,
19
19
  } from '../constructs';
20
+ import { QpqWebServerCacheConstruct } from '../constructs/feature/webserver/cache/QpqWebServerCacheConstruct';
20
21
 
21
22
  export interface InfQpqServiceStackProps extends QpqServiceStackProps {}
22
23
 
@@ -139,5 +140,16 @@ export class InfQpqServiceStack extends QpqServiceStack {
139
140
  websocketConfig: setting,
140
141
  }),
141
142
  );
143
+
144
+ // Cache settings
145
+ const cache = qpqWebServerUtils.getAllOwnedCacheConfigs(props.qpqConfig).map(
146
+ (setting) =>
147
+ new QpqWebServerCacheConstruct(this, qpqCoreUtils.getUniqueKeyForSetting(setting), {
148
+ awsAccountId: props.awsAccountId,
149
+ qpqConfig: props.qpqConfig,
150
+
151
+ cacheConfig: setting,
152
+ }),
153
+ );
142
154
  }
143
155
  }